author | llornkcor <llornkcor> | 2004-09-18 09:27:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-18 09:27:34 (UTC) |
commit | b45501194ab88d7fc898056df442430e7d6a2b22 (patch) (unidiff) | |
tree | 4fe36ced24e66b87d7969b46ba0a7623b98f21cc | |
parent | f0e025a8e64f96390377c0aa66e8b5602494d7d0 (diff) | |
download | opie-b45501194ab88d7fc898056df442430e7d6a2b22.zip opie-b45501194ab88d7fc898056df442430e7d6a2b22.tar.gz opie-b45501194ab88d7fc898056df442430e7d6a2b22.tar.bz2 |
add refresh menuitem
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b4461cb..4de7d38 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -32,512 +32,518 @@ | |||
32 | #include <dirent.h> | 32 | #include <dirent.h> |
33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
34 | #include <sys/vfs.h> | 34 | #include <sys/vfs.h> |
35 | #include <mntent.h> | 35 | #include <mntent.h> |
36 | 36 | ||
37 | using namespace Opie::Ui; | 37 | using namespace Opie::Ui; |
38 | 38 | ||
39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
40 | : QMainWindow( ) { | 40 | : QMainWindow( ) { |
41 | init(); | 41 | init(); |
42 | renameBox = 0; | 42 | renameBox = 0; |
43 | 43 | ||
44 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 44 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
45 | 45 | ||
46 | initConnections(); | 46 | initConnections(); |
47 | 47 | ||
48 | whichTab = 1; | 48 | whichTab = 1; |
49 | populateView(); | 49 | populateView(); |
50 | // rePopulate(); | 50 | // rePopulate(); |
51 | // currentPathCombo->setFocus(); | 51 | // currentPathCombo->setFocus(); |
52 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 52 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
53 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 53 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
54 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | 54 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
55 | 55 | ||
56 | // if( CurrentView() == Local_View) | 56 | // if( CurrentView() == Local_View) |
57 | // qDebug("LOCAL VIEW"); | 57 | // qDebug("LOCAL VIEW"); |
58 | // else | 58 | // else |
59 | // qDebug("REMOTE VIEW"); | 59 | // qDebug("REMOTE VIEW"); |
60 | switchToLocalTab(); | 60 | switchToLocalTab(); |
61 | } | 61 | } |
62 | 62 | ||
63 | AdvancedFm::~AdvancedFm() { | 63 | AdvancedFm::~AdvancedFm() { |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | void AdvancedFm::cleanUp() { | 67 | void AdvancedFm::cleanUp() { |
68 | QString sfile=QDir::homeDirPath(); | 68 | QString sfile=QDir::homeDirPath(); |
69 | if(sfile.right(1) != "/") | 69 | if(sfile.right(1) != "/") |
70 | sfile+="/._temp"; | 70 | sfile+="/._temp"; |
71 | else | 71 | else |
72 | sfile+="._temp"; | 72 | sfile+="._temp"; |
73 | QFile file( sfile); | 73 | QFile file( sfile); |
74 | if(file.exists()) | 74 | if(file.exists()) |
75 | file.remove(); | 75 | file.remove(); |
76 | } | 76 | } |
77 | 77 | ||
78 | void AdvancedFm::tabChanged(QWidget *wd) { | 78 | void AdvancedFm::tabChanged(QWidget *wd) { |
79 | if(wd == tab) | 79 | if(wd == tab) |
80 | odebug << "LOCAL VIEW SHOWN"<< oendl; | 80 | odebug << "LOCAL VIEW SHOWN"<< oendl; |
81 | else if(wd == tab_2) | 81 | else if(wd == tab_2) |
82 | odebug<< "REMOTE VIEW SHOWN"<< oendl; | 82 | odebug<< "REMOTE VIEW SHOWN"<< oendl; |
83 | 83 | ||
84 | QString path = CurrentDir()->canonicalPath(); | 84 | QString path = CurrentDir()->canonicalPath(); |
85 | currentPathCombo->lineEdit()->setText( path ); | 85 | currentPathCombo->lineEdit()->setText( path ); |
86 | 86 | ||
87 | if ( TabWidget->currentWidget() == tab) { | 87 | if ( TabWidget->currentWidget() == tab) { |
88 | // if(whichTab == 1) { | 88 | // if(whichTab == 1) { |
89 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 89 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
90 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 90 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
91 | } else { | 91 | } else { |
92 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 92 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 93 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
94 | } | 94 | } |
95 | 95 | ||
96 | QString fs= getFileSystemType( (const QString &) path); | 96 | QString fs= getFileSystemType( (const QString &) path); |
97 | 97 | ||
98 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 98 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
99 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 99 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
100 | chdir( path.latin1()); | 100 | chdir( path.latin1()); |
101 | if( wd == Local_View) { | 101 | if( wd == Local_View) { |
102 | Remote_View->clearFocus(); | 102 | Remote_View->clearFocus(); |
103 | } else { | 103 | } else { |
104 | Local_View->clearFocus(); | 104 | Local_View->clearFocus(); |
105 | } | 105 | } |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void AdvancedFm::populateView() { | 110 | void AdvancedFm::populateView() { |
111 | 111 | ||
112 | QPixmap pm; | 112 | QPixmap pm; |
113 | QListView *thisView = CurrentView(); | 113 | QListView *thisView = CurrentView(); |
114 | QDir *thisDir = CurrentDir(); | 114 | QDir *thisDir = CurrentDir(); |
115 | QString path = thisDir->canonicalPath(); | 115 | QString path = thisDir->canonicalPath(); |
116 | 116 | ||
117 | thisView->clear(); | 117 | thisView->clear(); |
118 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 118 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
119 | thisDir->setMatchAllDirs(TRUE); | 119 | thisDir->setMatchAllDirs(TRUE); |
120 | thisDir->setNameFilter(filterStr); | 120 | thisDir->setNameFilter(filterStr); |
121 | QString fileL, fileS, fileDate; | 121 | QString fileL, fileS, fileDate; |
122 | QString fs= getFileSystemType((const QString &) path); | 122 | QString fs= getFileSystemType((const QString &) path); |
123 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 123 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
124 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 124 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
125 | bool isDir=FALSE; | 125 | bool isDir=FALSE; |
126 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 126 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
127 | QFileInfoListIterator it(*list); | 127 | QFileInfoListIterator it(*list); |
128 | QFileInfo *fi; | 128 | QFileInfo *fi; |
129 | while ( (fi=it.current()) ) { | 129 | while ( (fi=it.current()) ) { |
130 | if (fi->isSymLink() ) { | 130 | if (fi->isSymLink() ) { |
131 | QString symLink=fi->readLink(); | 131 | QString symLink=fi->readLink(); |
132 | QFileInfo sym( symLink); | 132 | QFileInfo sym( symLink); |
133 | fileS.sprintf( "%10i", sym.size() ); | 133 | fileS.sprintf( "%10i", sym.size() ); |
134 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 134 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
135 | fileDate = sym.lastModified().toString(); | 135 | fileDate = sym.lastModified().toString(); |
136 | } else { | 136 | } else { |
137 | fileS.sprintf( "%10i", fi->size() ); | 137 | fileS.sprintf( "%10i", fi->size() ); |
138 | fileL = fi->fileName(); | 138 | fileL = fi->fileName(); |
139 | fileDate= fi->lastModified().toString(); | 139 | fileDate= fi->lastModified().toString(); |
140 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 140 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
141 | // if(fileL == "..") | 141 | // if(fileL == "..") |
142 | fileL += "/"; | 142 | fileL += "/"; |
143 | isDir=TRUE; | 143 | isDir=TRUE; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | QFileInfo fileInfo( path + "/" + fileL); | 146 | QFileInfo fileInfo( path + "/" + fileL); |
147 | 147 | ||
148 | if(fileL !="./" && fi->exists()) { | 148 | if(fileL !="./" && fi->exists()) { |
149 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 149 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
150 | 150 | ||
151 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 151 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
152 | 152 | ||
153 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 153 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
154 | pm = Resource::loadPixmap( "lockedfolder" ); | 154 | pm = Resource::loadPixmap( "lockedfolder" ); |
155 | else | 155 | else |
156 | pm= Resource::loadPixmap( "folder" ); | 156 | pm= Resource::loadPixmap( "folder" ); |
157 | } | 157 | } |
158 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 158 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
159 | pm = Resource::loadPixmap( "exec"); | 159 | pm = Resource::loadPixmap( "exec"); |
160 | } | 160 | } |
161 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 161 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
162 | | fileInfo.permission( QFileInfo::ExeGroup) | 162 | | fileInfo.permission( QFileInfo::ExeGroup) |
163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
164 | pm = Resource::loadPixmap( "exec"); | 164 | pm = Resource::loadPixmap( "exec"); |
165 | } | 165 | } |
166 | else if( !fi->isReadable() ) { | 166 | else if( !fi->isReadable() ) { |
167 | pm = Resource::loadPixmap( "locked" ); | 167 | pm = Resource::loadPixmap( "locked" ); |
168 | } | 168 | } |
169 | else { //everything else goes by mimetype | 169 | else { //everything else goes by mimetype |
170 | MimeType mt(fi->filePath()); | 170 | MimeType mt(fi->filePath()); |
171 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 171 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
172 | if(pm.isNull()) { | 172 | if(pm.isNull()) { |
173 | pm = unknownXpm; | 173 | pm = unknownXpm; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 176 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
177 | // odebug << " overlay link image" << oendl; | 177 | // odebug << " overlay link image" << oendl; |
178 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 178 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
179 | // pm= Resource::loadPixmap( "folder" ); | 179 | // pm= Resource::loadPixmap( "folder" ); |
180 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 180 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
181 | // QPainter painter( &pm ); | 181 | // QPainter painter( &pm ); |
182 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 182 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
183 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 183 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
184 | } | 184 | } |
185 | item->setPixmap( 0,pm); | 185 | item->setPixmap( 0,pm); |
186 | 186 | ||
187 | } | 187 | } |
188 | isDir=FALSE; | 188 | isDir=FALSE; |
189 | ++it; | 189 | ++it; |
190 | } | 190 | } |
191 | 191 | ||
192 | if( path.find("dev",0,TRUE) != -1) { | 192 | if( path.find("dev",0,TRUE) != -1) { |
193 | struct stat buf; | 193 | struct stat buf; |
194 | dev_t devT; | 194 | dev_t devT; |
195 | DIR *dir; | 195 | DIR *dir; |
196 | struct dirent *mydirent; | 196 | struct dirent *mydirent; |
197 | 197 | ||
198 | if((dir = opendir( path.latin1())) != NULL) | 198 | if((dir = opendir( path.latin1())) != NULL) |
199 | while ((mydirent = readdir(dir)) != NULL) { | 199 | while ((mydirent = readdir(dir)) != NULL) { |
200 | lstat( mydirent->d_name, &buf); | 200 | lstat( mydirent->d_name, &buf); |
201 | // odebug << mydirent->d_name << oendl; | 201 | // odebug << mydirent->d_name << oendl; |
202 | fileL.sprintf("%s", mydirent->d_name); | 202 | fileL.sprintf("%s", mydirent->d_name); |
203 | devT = buf.st_dev; | 203 | devT = buf.st_dev; |
204 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 204 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
205 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 205 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
206 | if( fileL.find(".") == -1 ) { | 206 | if( fileL.find(".") == -1 ) { |
207 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 207 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
208 | pm = unknownXpm; | 208 | pm = unknownXpm; |
209 | item->setPixmap( 0,pm); | 209 | item->setPixmap( 0,pm); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | closedir(dir); | 213 | closedir(dir); |
214 | } | 214 | } |
215 | 215 | ||
216 | thisView->setSorting( 3,FALSE); | 216 | thisView->setSorting( 3,FALSE); |
217 | fillCombo( (const QString &) path ); | 217 | fillCombo( (const QString &) path ); |
218 | } | 218 | } |
219 | 219 | ||
220 | void AdvancedFm::rePopulate() { | 220 | void AdvancedFm::rePopulate() { |
221 | populateView(); | 221 | populateView(); |
222 | setOtherTabCurrent(); | 222 | setOtherTabCurrent(); |
223 | populateView(); | 223 | populateView(); |
224 | 224 | ||
225 | // int tmpTab = whichTab; | 225 | // int tmpTab = whichTab; |
226 | // // odebug << "" << tmpTab << "" << oendl; | 226 | // // odebug << "" << tmpTab << "" << oendl; |
227 | 227 | ||
228 | // for(int i =1; i < 3; i++) { | 228 | // for(int i =1; i < 3; i++) { |
229 | // TabWidget->setCurrentWidget(i - 1); | 229 | // TabWidget->setCurrentWidget(i - 1); |
230 | // populateView(); | 230 | // populateView(); |
231 | // } | 231 | // } |
232 | // TabWidget->setCurrentWidget( tmpTab - 1); | 232 | // TabWidget->setCurrentWidget( tmpTab - 1); |
233 | } | 233 | } |
234 | 234 | ||
235 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 235 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
236 | if ( TabWidget->currentWidget() == tab) | 236 | if ( TabWidget->currentWidget() == tab) |
237 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); | 237 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); |
238 | else | 238 | else |
239 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); | 239 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); |
240 | 240 | ||
241 | 241 | ||
242 | if(selectedItem) { | 242 | if(selectedItem) { |
243 | QString strItem=selectedItem->text(0); | 243 | QString strItem=selectedItem->text(0); |
244 | // owarn << strItem << oendl; | 244 | // owarn << strItem << oendl; |
245 | QString strSize=selectedItem->text(1); | 245 | QString strSize=selectedItem->text(1); |
246 | strSize=strSize.stripWhiteSpace(); | 246 | strSize=strSize.stripWhiteSpace(); |
247 | bool isDirectory = false; | 247 | bool isDirectory = false; |
248 | QString strItem2; | 248 | QString strItem2; |
249 | 249 | ||
250 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | 250 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
251 | strItem2 = dealWithSymName((const QString&)strItem); | 251 | strItem2 = dealWithSymName((const QString&)strItem); |
252 | if(QDir(strItem2).exists() ) | 252 | if(QDir(strItem2).exists() ) |
253 | strItem = strItem2; | 253 | strItem = strItem2; |
254 | } | 254 | } |
255 | 255 | ||
256 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 256 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
257 | 257 | ||
258 | if(QDir(strItem).exists()) | 258 | if(QDir(strItem).exists()) |
259 | isDirectory = true; | 259 | isDirectory = true; |
260 | } | 260 | } |
261 | 261 | ||
262 | if( isDirectory ) { | 262 | if( isDirectory ) { |
263 | CurrentDir()->cd( strItem, TRUE); | 263 | CurrentDir()->cd( strItem, TRUE); |
264 | populateView(); | 264 | populateView(); |
265 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 265 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
266 | } | 266 | } |
267 | chdir( strItem.latin1()); | 267 | chdir( strItem.latin1()); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 271 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
272 | Q_UNUSED(item); | 272 | Q_UNUSED(item); |
273 | switch (mouse) { | 273 | switch (mouse) { |
274 | case 1: | 274 | case 1: |
275 | { | 275 | { |
276 | if(renameBox != 0 ) { | 276 | if(renameBox != 0 ) { |
277 | cancelRename(); | 277 | cancelRename(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | break; | 280 | break; |
281 | // case 2: | 281 | // case 2: |
282 | // menuTimer.start( 50, TRUE ); | 282 | // menuTimer.start( 50, TRUE ); |
283 | // break; | 283 | // break; |
284 | }; | 284 | }; |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | void AdvancedFm::refreshCurrentTab() { | ||
289 | populateView(); | ||
290 | // if ( TabWidget->currentWidget() == tab) { | ||
291 | |||
292 | } | ||
293 | |||
288 | void AdvancedFm::switchToLocalTab() { | 294 | void AdvancedFm::switchToLocalTab() { |
289 | TabWidget->setCurrentWidget(0); | 295 | TabWidget->setCurrentWidget(0); |
290 | Local_View->setFocus(); | 296 | Local_View->setFocus(); |
291 | 297 | ||
292 | } | 298 | } |
293 | 299 | ||
294 | void AdvancedFm::switchToRemoteTab() { | 300 | void AdvancedFm::switchToRemoteTab() { |
295 | TabWidget->setCurrentWidget(1); | 301 | TabWidget->setCurrentWidget(1); |
296 | Remote_View->setFocus(); | 302 | Remote_View->setFocus(); |
297 | } | 303 | } |
298 | 304 | ||
299 | void AdvancedFm::readConfig() { | 305 | void AdvancedFm::readConfig() { |
300 | Config cfg("AdvancedFm"); | 306 | Config cfg("AdvancedFm"); |
301 | } | 307 | } |
302 | 308 | ||
303 | void AdvancedFm::writeConfig() { | 309 | void AdvancedFm::writeConfig() { |
304 | Config cfg("AdvancedFm"); | 310 | Config cfg("AdvancedFm"); |
305 | } | 311 | } |
306 | 312 | ||
307 | void AdvancedFm::currentPathComboChanged() { | 313 | void AdvancedFm::currentPathComboChanged() { |
308 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 314 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
309 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 315 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
310 | populateView(); | 316 | populateView(); |
311 | } else { | 317 | } else { |
312 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 318 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
313 | } | 319 | } |
314 | } | 320 | } |
315 | 321 | ||
316 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 322 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
317 | 323 | ||
318 | if ( TabWidget->currentWidget() == tab) { | 324 | if ( TabWidget->currentWidget() == tab) { |
319 | // if ( whichTab == 1) { | 325 | // if ( whichTab == 1) { |
320 | currentPathCombo->lineEdit()->setText( currentPath); | 326 | currentPathCombo->lineEdit()->setText( currentPath); |
321 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 327 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
322 | currentPathCombo->clear(); | 328 | currentPathCombo->clear(); |
323 | localDirPathStringList.prepend( currentPath ); | 329 | localDirPathStringList.prepend( currentPath ); |
324 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 330 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
325 | } | 331 | } |
326 | } else { | 332 | } else { |
327 | currentPathCombo->lineEdit()->setText( currentPath); | 333 | currentPathCombo->lineEdit()->setText( currentPath); |
328 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 334 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
329 | currentPathCombo->clear(); | 335 | currentPathCombo->clear(); |
330 | remoteDirPathStringList.prepend( currentPath ); | 336 | remoteDirPathStringList.prepend( currentPath ); |
331 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 337 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
332 | } | 338 | } |
333 | } | 339 | } |
334 | } | 340 | } |
335 | 341 | ||
336 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 342 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
337 | chdir( currentPath.latin1() ); | 343 | chdir( currentPath.latin1() ); |
338 | CurrentDir()->cd( currentPath, TRUE); | 344 | CurrentDir()->cd( currentPath, TRUE); |
339 | populateView(); | 345 | populateView(); |
340 | update(); | 346 | update(); |
341 | } | 347 | } |
342 | 348 | ||
343 | QStringList AdvancedFm::getPath() { | 349 | QStringList AdvancedFm::getPath() { |
344 | QStringList strList; | 350 | QStringList strList; |
345 | QListView *thisView=CurrentView(); | 351 | QListView *thisView=CurrentView(); |
346 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 352 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
347 | QListViewItemIterator it( thisView ); | 353 | QListViewItemIterator it( thisView ); |
348 | for ( ; it.current(); ++it ) { | 354 | for ( ; it.current(); ++it ) { |
349 | if ( it.current()->isSelected() ) { | 355 | if ( it.current()->isSelected() ) { |
350 | strList << it.current()->text(0); | 356 | strList << it.current()->text(0); |
351 | // odebug << it.current()->text(0) << oendl; | 357 | // odebug << it.current()->text(0) << oendl; |
352 | } | 358 | } |
353 | } | 359 | } |
354 | return strList; | 360 | return strList; |
355 | } | 361 | } |
356 | 362 | ||
357 | void AdvancedFm::homeButtonPushed() { | 363 | void AdvancedFm::homeButtonPushed() { |
358 | QString current = QDir::homeDirPath(); | 364 | QString current = QDir::homeDirPath(); |
359 | chdir( current.latin1() ); | 365 | chdir( current.latin1() ); |
360 | CurrentDir()->cd( current, TRUE); | 366 | CurrentDir()->cd( current, TRUE); |
361 | populateView(); | 367 | populateView(); |
362 | update(); | 368 | update(); |
363 | } | 369 | } |
364 | 370 | ||
365 | void AdvancedFm::docButtonPushed() { | 371 | void AdvancedFm::docButtonPushed() { |
366 | QString current = QPEApplication::documentDir(); | 372 | QString current = QPEApplication::documentDir(); |
367 | chdir( current.latin1() ); | 373 | chdir( current.latin1() ); |
368 | CurrentDir()->cd( current, TRUE); | 374 | CurrentDir()->cd( current, TRUE); |
369 | populateView(); | 375 | populateView(); |
370 | update(); | 376 | update(); |
371 | } | 377 | } |
372 | 378 | ||
373 | void AdvancedFm::SDButtonPushed() { | 379 | void AdvancedFm::SDButtonPushed() { |
374 | QString current = "/mnt/card";// this can change so fix | 380 | QString current = "/mnt/card";// this can change so fix |
375 | chdir( current.latin1() ); | 381 | chdir( current.latin1() ); |
376 | CurrentDir()->cd( current, TRUE); | 382 | CurrentDir()->cd( current, TRUE); |
377 | populateView(); | 383 | populateView(); |
378 | update(); | 384 | update(); |
379 | } | 385 | } |
380 | 386 | ||
381 | void AdvancedFm::CFButtonPushed() { | 387 | void AdvancedFm::CFButtonPushed() { |
382 | QString current; | 388 | QString current; |
383 | if(zaurusDevice) | 389 | if(zaurusDevice) |
384 | current= "/mnt/cf"; //zaurus | 390 | current= "/mnt/cf"; //zaurus |
385 | else | 391 | else |
386 | current = "/mnt/hda"; //ipaq | 392 | current = "/mnt/hda"; //ipaq |
387 | chdir( current.latin1() ); | 393 | chdir( current.latin1() ); |
388 | CurrentDir()->cd( current, TRUE); | 394 | CurrentDir()->cd( current, TRUE); |
389 | populateView(); | 395 | populateView(); |
390 | update(); | 396 | update(); |
391 | } | 397 | } |
392 | 398 | ||
393 | 399 | ||
394 | void AdvancedFm::doAbout() { | 400 | void AdvancedFm::doAbout() { |
395 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 401 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
396 | "is copyright 2002-2003 by\n" | 402 | "is copyright 2002-2003 by\n" |
397 | "L.J.Potter<llornkcor@handhelds.org>\n" | 403 | "L.J.Potter<llornkcor@handhelds.org>\n" |
398 | "and is licensed by the GPL")); | 404 | "and is licensed by the GPL")); |
399 | } | 405 | } |
400 | 406 | ||
401 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 407 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
402 | // owarn << "key " << e->key() << "" << oendl; | 408 | // owarn << "key " << e->key() << "" << oendl; |
403 | // if( CurrentView()->hasFocus() ) | 409 | // if( CurrentView()->hasFocus() ) |
404 | { | 410 | { |
405 | switch ( e->key() ) { | 411 | switch ( e->key() ) { |
406 | case Key_Left: | 412 | case Key_Left: |
407 | upDir(); | 413 | upDir(); |
408 | break; | 414 | break; |
409 | case Key_Next: | 415 | case Key_Next: |
410 | break; | 416 | break; |
411 | case Key_Return: | 417 | case Key_Return: |
412 | case Key_Enter: | 418 | case Key_Enter: |
413 | navigateToSelected(); | 419 | navigateToSelected(); |
414 | break; | 420 | break; |
415 | case Key_Tab: { | 421 | case Key_Tab: { |
416 | setOtherTabCurrent(); | 422 | setOtherTabCurrent(); |
417 | } | 423 | } |
418 | break; | 424 | break; |
419 | case Key_Delete: | 425 | case Key_Delete: |
420 | del(); | 426 | del(); |
421 | break; | 427 | break; |
422 | case Key_A: | 428 | case Key_A: |
423 | copyAs(); | 429 | copyAs(); |
424 | break; | 430 | break; |
425 | case Key_C: | 431 | case Key_C: |
426 | copy(); | 432 | copy(); |
427 | break; | 433 | break; |
428 | case Key_E: | 434 | case Key_E: |
429 | runThis(); | 435 | runThis(); |
430 | break; | 436 | break; |
431 | case Key_G: | 437 | case Key_G: |
432 | { | 438 | { |
433 | currentPathCombo->lineEdit()->setFocus(); | 439 | currentPathCombo->lineEdit()->setFocus(); |
434 | } | 440 | } |
435 | break; | 441 | break; |
436 | 442 | ||
437 | case Key_H: | 443 | case Key_H: |
438 | showHidden(); | 444 | showHidden(); |
439 | break; | 445 | break; |
440 | case Key_I: | 446 | case Key_I: |
441 | fileStatus(); | 447 | fileStatus(); |
442 | break; | 448 | break; |
443 | case Key_M: | 449 | case Key_M: |
444 | move(); | 450 | move(); |
445 | break; | 451 | break; |
446 | case Key_N: | 452 | case Key_N: |
447 | mkDir(); | 453 | mkDir(); |
448 | break; | 454 | break; |
449 | case Key_P: | 455 | case Key_P: |
450 | filePerms(); | 456 | filePerms(); |
451 | break; | 457 | break; |
452 | case Key_R: | 458 | case Key_R: |
453 | rn(); | 459 | rn(); |
454 | break; | 460 | break; |
455 | case Key_U: | 461 | case Key_U: |
456 | upDir(); | 462 | upDir(); |
457 | break; | 463 | break; |
458 | case Key_1: | 464 | case Key_1: |
459 | switchToLocalTab(); | 465 | switchToLocalTab(); |
460 | break; | 466 | break; |
461 | case Key_2: | 467 | case Key_2: |
462 | switchToRemoteTab(); | 468 | switchToRemoteTab(); |
463 | break; | 469 | break; |
464 | case Key_3: | 470 | case Key_3: |
465 | CFButtonPushed(); | 471 | CFButtonPushed(); |
466 | break; | 472 | break; |
467 | case Key_4: | 473 | case Key_4: |
468 | SDButtonPushed(); | 474 | SDButtonPushed(); |
469 | break; | 475 | break; |
470 | case Key_5: | 476 | case Key_5: |
471 | homeButtonPushed(); | 477 | homeButtonPushed(); |
472 | break; | 478 | break; |
473 | case Key_6: | 479 | case Key_6: |
474 | docButtonPushed(); | 480 | docButtonPushed(); |
475 | break; | 481 | break; |
476 | case Key_7: | 482 | case Key_7: |
477 | break; | 483 | break; |
478 | case Key_8: | 484 | case Key_8: |
479 | break; | 485 | break; |
480 | case Key_9: | 486 | case Key_9: |
481 | break; | 487 | break; |
482 | case Key_0: | 488 | case Key_0: |
483 | break; | 489 | break; |
484 | }; | 490 | }; |
485 | e->accept(); | 491 | e->accept(); |
486 | } | 492 | } |
487 | } | 493 | } |
488 | 494 | ||
489 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 495 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
490 | if( CurrentView()->hasFocus() ) | 496 | if( CurrentView()->hasFocus() ) |
491 | e->ignore(); | 497 | e->ignore(); |
492 | } | 498 | } |
493 | 499 | ||
494 | 500 | ||
495 | void AdvancedFm::QPEButtonPushed() { | 501 | void AdvancedFm::QPEButtonPushed() { |
496 | QString current = QPEApplication::qpeDir(); | 502 | QString current = QPEApplication::qpeDir(); |
497 | chdir( current.latin1() ); | 503 | chdir( current.latin1() ); |
498 | CurrentDir()->cd( current, TRUE); | 504 | CurrentDir()->cd( current, TRUE); |
499 | populateView(); | 505 | populateView(); |
500 | update(); | 506 | update(); |
501 | } | 507 | } |
502 | 508 | ||
503 | void AdvancedFm::parsetab(const QString &fileName) { | 509 | void AdvancedFm::parsetab(const QString &fileName) { |
504 | 510 | ||
505 | fileSystemTypeList.clear(); | 511 | fileSystemTypeList.clear(); |
506 | fsList.clear(); | 512 | fsList.clear(); |
507 | struct mntent *me; | 513 | struct mntent *me; |
508 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 514 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
509 | if ( mntfp ) { | 515 | if ( mntfp ) { |
510 | while ( (me = getmntent( mntfp )) != 0 ) { | 516 | while ( (me = getmntent( mntfp )) != 0 ) { |
511 | QString deviceName = me->mnt_fsname; | 517 | QString deviceName = me->mnt_fsname; |
512 | QString filesystemType = me->mnt_type; | 518 | QString filesystemType = me->mnt_type; |
513 | QString mountDir = me->mnt_dir; | 519 | QString mountDir = me->mnt_dir; |
514 | if(deviceName != "none") { | 520 | if(deviceName != "none") { |
515 | if( fsList.contains(filesystemType) == 0 | 521 | if( fsList.contains(filesystemType) == 0 |
516 | & filesystemType.find("proc",0,TRUE) == -1 | 522 | & filesystemType.find("proc",0,TRUE) == -1 |
517 | & filesystemType.find("cramfs",0,TRUE) == -1 | 523 | & filesystemType.find("cramfs",0,TRUE) == -1 |
518 | & filesystemType.find("auto",0,TRUE) == -1) | 524 | & filesystemType.find("auto",0,TRUE) == -1) |
519 | fsList << filesystemType; | 525 | fsList << filesystemType; |
520 | fileSystemTypeList << mountDir+"::"+filesystemType; | 526 | fileSystemTypeList << mountDir+"::"+filesystemType; |
521 | } | 527 | } |
522 | } | 528 | } |
523 | } | 529 | } |
524 | endmntent( mntfp ); | 530 | endmntent( mntfp ); |
525 | } | 531 | } |
526 | 532 | ||
527 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 533 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
528 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 534 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
529 | QString current = currentText;//.right( currentText.length()-1); | 535 | QString current = currentText;//.right( currentText.length()-1); |
530 | QString baseFs; | 536 | QString baseFs; |
531 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 537 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
532 | QString temp = (*it); | 538 | QString temp = (*it); |
533 | QString path = temp.left(temp.find("::",0,TRUE) ); | 539 | QString path = temp.left(temp.find("::",0,TRUE) ); |
534 | path = path.right( path.length()-1); | 540 | path = path.right( path.length()-1); |
535 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 541 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
536 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 542 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
537 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 543 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
538 | } | 544 | } |
539 | } | 545 | } |
540 | return baseFs; | 546 | return baseFs; |
541 | } | 547 | } |
542 | 548 | ||
543 | QString AdvancedFm::getDiskSpace( const QString &path) { | 549 | QString AdvancedFm::getDiskSpace( const QString &path) { |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index e596977..def6fe2 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,186 +1,186 @@ | |||
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 <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 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); | 58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); |
59 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
60 | protected slots: | 60 | protected slots: |
61 | void slotSwitchMenu(int); | 61 | void slotSwitchMenu(int); |
62 | void selectAll(); | 62 | void selectAll(); |
63 | void addToDocs(); | 63 | void addToDocs(); |
64 | void doDirChange(); | 64 | void doDirChange(); |
65 | void mkDir(); | 65 | void mkDir(); |
66 | void del(); | 66 | void del(); |
67 | void rn(); | 67 | void rn(); |
68 | void populateView(); | 68 | void populateView(); |
69 | void rePopulate(); | 69 | void rePopulate(); |
70 | void showHidden(); | 70 | void showHidden(); |
71 | void showMenuHidden(); | 71 | void showMenuHidden(); |
72 | void writeConfig(); | 72 | void writeConfig(); |
73 | void readConfig(); | 73 | void readConfig(); |
74 | void ListClicked(QListViewItem *); | 74 | void ListClicked(QListViewItem *); |
75 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 75 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
76 | void makeDir(); | 76 | void makeDir(); |
77 | void doDelete(); | 77 | void doDelete(); |
78 | void tabChanged(QWidget*); | 78 | void tabChanged(QWidget*); |
79 | void cleanUp(); | 79 | void cleanUp(); |
80 | void renameIt(); | 80 | void renameIt(); |
81 | void runThis(); | 81 | void runThis(); |
82 | void runText(); | 82 | void runText(); |
83 | void filePerms(); | 83 | void filePerms(); |
84 | void doProperties(); | 84 | void doProperties(); |
85 | void runCommand(); | 85 | void runCommand(); |
86 | void runCommandStd(); | 86 | void runCommandStd(); |
87 | QStringList getPath(); | 87 | QStringList getPath(); |
88 | void mkSym(); | 88 | void mkSym(); |
89 | void switchToLocalTab(); | 89 | void switchToLocalTab(); |
90 | void switchToRemoteTab(); | 90 | void switchToRemoteTab(); |
91 | 91 | void refreshCurrentTab(); | |
92 | protected: | 92 | protected: |
93 | 93 | ||
94 | Opie::Ui::OSplitter *TabWidget; | 94 | Opie::Ui::OSplitter *TabWidget; |
95 | QCopChannel * channel; | 95 | QCopChannel * channel; |
96 | QPixmap unknownXpm; | 96 | QPixmap unknownXpm; |
97 | int whichTab; | 97 | int whichTab; |
98 | // QTabWidget *TabWidget; | 98 | // QTabWidget *TabWidget; |
99 | QWidget *tab, *tab_2, *tab_3; | 99 | QWidget *tab, *tab_2, *tab_3; |
100 | QListView *Local_View, *Remote_View; | 100 | QListView *Local_View, *Remote_View; |
101 | 101 | ||
102 | QLineEdit *currentPathEdit; | 102 | QLineEdit *currentPathEdit; |
103 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 103 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
104 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 104 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
105 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 105 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
106 | QDir currentDir, currentRemoteDir; | 106 | QDir currentDir, currentRemoteDir; |
107 | QComboBox *currentPathCombo; | 107 | QComboBox *currentPathCombo; |
108 | QString filterStr, s_addBookmark, s_removeBookmark; | 108 | QString filterStr, s_addBookmark, s_removeBookmark; |
109 | QListViewItem * item; | 109 | QListViewItem * item; |
110 | bool b; | 110 | bool b; |
111 | QStringList fileSystemTypeList, fsList; | 111 | QStringList fileSystemTypeList, fsList; |
112 | int currentServerConfig; | 112 | int currentServerConfig; |
113 | bool zaurusDevice; | 113 | bool zaurusDevice; |
114 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 114 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
115 | QStringList remoteDirPathStringList, localDirPathStringList; | 115 | QStringList remoteDirPathStringList, localDirPathStringList; |
116 | QLineEdit *renameBox; | 116 | QLineEdit *renameBox; |
117 | 117 | ||
118 | void init(); | 118 | void init(); |
119 | void initConnections(); | 119 | void initConnections(); |
120 | void keyReleaseEvent( QKeyEvent *); | 120 | void keyReleaseEvent( QKeyEvent *); |
121 | void keyPressEvent( QKeyEvent *); | 121 | void keyPressEvent( QKeyEvent *); |
122 | QString getFileSystemType(const QString &); | 122 | QString getFileSystemType(const QString &); |
123 | QString getDiskSpace(const QString &); | 123 | QString getDiskSpace(const QString &); |
124 | void parsetab(const QString &fileName); | 124 | void parsetab(const QString &fileName); |
125 | QString checkDiskSpace(const QString &); | 125 | QString checkDiskSpace(const QString &); |
126 | QString dealWithSymName(const QString &); | 126 | QString dealWithSymName(const QString &); |
127 | QDir *CurrentDir(); | 127 | QDir *CurrentDir(); |
128 | QDir *OtherDir(); | 128 | QDir *OtherDir(); |
129 | QListView *CurrentView(); | 129 | QListView *CurrentView(); |
130 | QListView *OtherView(); | 130 | QListView *OtherView(); |
131 | void setOtherTabCurrent(); | 131 | void setOtherTabCurrent(); |
132 | 132 | ||
133 | protected slots: | 133 | protected slots: |
134 | 134 | ||
135 | void openSearch(); | 135 | void openSearch(); |
136 | void dirMenuSelected(int); | 136 | void dirMenuSelected(int); |
137 | void showFileMenu(); | 137 | void showFileMenu(); |
138 | void homeButtonPushed(); | 138 | void homeButtonPushed(); |
139 | void docButtonPushed(); | 139 | void docButtonPushed(); |
140 | void SDButtonPushed(); | 140 | void SDButtonPushed(); |
141 | void CFButtonPushed(); | 141 | void CFButtonPushed(); |
142 | void QPEButtonPushed(); | 142 | void QPEButtonPushed(); |
143 | void upDir(); | 143 | void upDir(); |
144 | void currentPathComboChanged(); | 144 | void currentPathComboChanged(); |
145 | void copy(); | 145 | void copy(); |
146 | void copyAs(); | 146 | void copyAs(); |
147 | void copySameDir(); | 147 | void copySameDir(); |
148 | void currentPathComboActivated(const QString &); | 148 | void currentPathComboActivated(const QString &); |
149 | void fillCombo(const QString &); | 149 | void fillCombo(const QString &); |
150 | bool copyFile( const QString & , const QString & ); | 150 | bool copyFile( const QString & , const QString & ); |
151 | void move(); | 151 | void move(); |
152 | void fileStatus(); | 152 | void fileStatus(); |
153 | void doAbout(); | 153 | void doAbout(); |
154 | void doBeam(); | 154 | void doBeam(); |
155 | void fileBeamFinished( Ir *); | 155 | void fileBeamFinished( Ir *); |
156 | bool copyDirectory( const QString & , const QString & ); | 156 | bool copyDirectory( const QString & , const QString & ); |
157 | // void navigateToSelected(); | 157 | // void navigateToSelected(); |
158 | bool moveDirectory( const QString & , const QString & ); | 158 | bool moveDirectory( const QString & , const QString & ); |
159 | 159 | ||
160 | // void slotSwitchtoLocal(int); | 160 | // void slotSwitchtoLocal(int); |
161 | 161 | ||
162 | private: | 162 | private: |
163 | MenuButton *menuButton; | 163 | MenuButton *menuButton; |
164 | QString oldName; | 164 | QString oldName; |
165 | void startProcess(const QString &); | 165 | void startProcess(const QString &); |
166 | bool eventFilter( QObject * , QEvent * ); | 166 | bool eventFilter( QObject * , QEvent * ); |
167 | void cancelRename(); | 167 | void cancelRename(); |
168 | void doRename(QListView *); | 168 | void doRename(QListView *); |
169 | void okRename(); | 169 | void okRename(); |
170 | void customDirsToMenu(); | 170 | void customDirsToMenu(); |
171 | void addCustomDir(); | 171 | void addCustomDir(); |
172 | void removeCustomDir(); | 172 | void removeCustomDir(); |
173 | void gotoDirectory(const QString &); | 173 | void gotoDirectory(const QString &); |
174 | void navigateToSelected(); | 174 | void navigateToSelected(); |
175 | void findFile(const QString &); | 175 | void findFile(const QString &); |
176 | 176 | ||
177 | private slots: | 177 | private slots: |
178 | void processEnded(Opie::Core::OProcess *); | 178 | void processEnded(Opie::Core::OProcess *); |
179 | void oprocessStderr(Opie::Core::OProcess *, char *, int); | 179 | void oprocessStderr(Opie::Core::OProcess *, char *, int); |
180 | void gotoCustomDir(const QString &); | 180 | void gotoCustomDir(const QString &); |
181 | void qcopReceive(const QCString&, const QByteArray&); | 181 | void qcopReceive(const QCString&, const QByteArray&); |
182 | void setDocument(const QString &); | 182 | void setDocument(const QString &); |
183 | 183 | ||
184 | }; | 184 | }; |
185 | 185 | ||
186 | #endif // ADVANCEDFM_H | 186 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index dc7e8e1..1802571 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,295 +1,296 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <qpe/storage.h> | 16 | #include <qpe/storage.h> |
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | #include <qpe/menubutton.h> | 19 | #include <qpe/menubutton.h> |
20 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
21 | using namespace Opie::Ui; | 21 | using namespace Opie::Ui; |
22 | 22 | ||
23 | /* QT */ | 23 | /* QT */ |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qlistview.h> | 30 | #include <qlistview.h> |
31 | 31 | ||
32 | /* STD */ | 32 | /* STD */ |
33 | #include <sys/utsname.h> | 33 | #include <sys/utsname.h> |
34 | 34 | ||
35 | void AdvancedFm::init() { | 35 | void AdvancedFm::init() { |
36 | b = false; | 36 | b = false; |
37 | setCaption( tr( "AdvancedFm" ) ); | 37 | setCaption( tr( "AdvancedFm" ) ); |
38 | 38 | ||
39 | QVBoxLayout *layout = new QVBoxLayout( this ); | 39 | QVBoxLayout *layout = new QVBoxLayout( this ); |
40 | layout->setSpacing( 2); | 40 | layout->setSpacing( 2); |
41 | layout->setMargin( 0); // squeeze | 41 | layout->setMargin( 0); // squeeze |
42 | 42 | ||
43 | QMenuBar *menuBar = new QMenuBar(this); | 43 | QMenuBar *menuBar = new QMenuBar(this); |
44 | menuBar->setMargin( 0 ); // squeeze | 44 | menuBar->setMargin( 0 ); // squeeze |
45 | fileMenu = new QPopupMenu( this ); | 45 | fileMenu = new QPopupMenu( this ); |
46 | viewMenu = new QPopupMenu( this ); | 46 | viewMenu = new QPopupMenu( this ); |
47 | // customDirMenu = new QPopupMenu( this ); | 47 | // customDirMenu = new QPopupMenu( this ); |
48 | 48 | ||
49 | layout->addWidget( menuBar ); | 49 | layout->addWidget( menuBar ); |
50 | 50 | ||
51 | menuBar->insertItem( tr( "File" ), fileMenu); | 51 | menuBar->insertItem( tr( "File" ), fileMenu); |
52 | menuBar->insertItem( tr( "View" ), viewMenu); | 52 | menuBar->insertItem( tr( "View" ), viewMenu); |
53 | 53 | ||
54 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 54 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
55 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 55 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
56 | cdUpButton->setAutoRaise( true ); | 56 | cdUpButton->setAutoRaise( true ); |
57 | menuBar->insertItem( cdUpButton ); | 57 | menuBar->insertItem( cdUpButton ); |
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 61 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
62 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 62 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
63 | qpeDirButton->setAutoRaise( true ); | 63 | qpeDirButton->setAutoRaise( true ); |
64 | menuBar->insertItem( qpeDirButton ); | 64 | menuBar->insertItem( qpeDirButton ); |
65 | 65 | ||
66 | cfButton = new QToolButton( 0, "CFButton"); | 66 | cfButton = new QToolButton( 0, "CFButton"); |
67 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 67 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
68 | cfButton->setAutoRaise( true ); | 68 | cfButton->setAutoRaise( true ); |
69 | menuBar->insertItem( cfButton ); | 69 | menuBar->insertItem( cfButton ); |
70 | 70 | ||
71 | sdButton = new QToolButton( 0, "SDButton"); | 71 | sdButton = new QToolButton( 0, "SDButton"); |
72 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 72 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
73 | sdButton->setAutoRaise( true ); | 73 | sdButton->setAutoRaise( true ); |
74 | menuBar->insertItem( sdButton ); | 74 | menuBar->insertItem( sdButton ); |
75 | 75 | ||
76 | docButton = new QToolButton( 0,"docsButton"); | 76 | docButton = new QToolButton( 0,"docsButton"); |
77 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 77 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
78 | docButton->setAutoRaise( true ); | 78 | docButton->setAutoRaise( true ); |
79 | menuBar->insertItem( docButton ); | 79 | menuBar->insertItem( docButton ); |
80 | 80 | ||
81 | homeButton = new QToolButton( 0, "homeButton"); | 81 | homeButton = new QToolButton( 0, "homeButton"); |
82 | homeButton->setPixmap(Resource::loadPixmap("home")); | 82 | homeButton->setPixmap(Resource::loadPixmap("home")); |
83 | homeButton->setAutoRaise( true ); | 83 | homeButton->setAutoRaise( true ); |
84 | menuBar->insertItem( homeButton ); | 84 | menuBar->insertItem( homeButton ); |
85 | 85 | ||
86 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 86 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
87 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 87 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
88 | fileMenu->insertSeparator(); | 88 | fileMenu->insertSeparator(); |
89 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 89 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
90 | fileMenu->insertSeparator(); | 90 | fileMenu->insertSeparator(); |
91 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 91 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
92 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 92 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
93 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 93 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
94 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 94 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
95 | fileMenu->insertSeparator(); | 95 | fileMenu->insertSeparator(); |
96 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 96 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
97 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 97 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
98 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 98 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
99 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 99 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
100 | fileMenu->setCheckable(TRUE); | 100 | fileMenu->setCheckable(TRUE); |
101 | 101 | ||
102 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 102 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
103 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 103 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
104 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); | ||
104 | // viewMenu->insertSeparator(); | 105 | // viewMenu->insertSeparator(); |
105 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 106 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
106 | viewMenu->setCheckable(true); | 107 | viewMenu->setCheckable(true); |
107 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 108 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
108 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 109 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
109 | 110 | ||
110 | s_addBookmark = tr("Bookmark Directory"); | 111 | s_addBookmark = tr("Bookmark Directory"); |
111 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 112 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
112 | 113 | ||
113 | // menuButton->insertItem(""); | 114 | // menuButton->insertItem(""); |
114 | 115 | ||
115 | // customDirMenu->insertItem(tr("Add This Directory")); | 116 | // customDirMenu->insertItem(tr("Add This Directory")); |
116 | // customDirMenu->insertItem(tr("Remove This Directory")); | 117 | // customDirMenu->insertItem(tr("Remove This Directory")); |
117 | // customDirMenu->insertSeparator(); | 118 | // customDirMenu->insertSeparator(); |
118 | 119 | ||
119 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 120 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
120 | CBHB->setMargin( 0 ); | 121 | CBHB->setMargin( 0 ); |
121 | CBHB->setSpacing( 1 ); | 122 | CBHB->setSpacing( 1 ); |
122 | 123 | ||
123 | menuButton = new MenuButton( this ); | 124 | menuButton = new MenuButton( this ); |
124 | 125 | ||
125 | menuButton->setUseLabel(false); | 126 | menuButton->setUseLabel(false); |
126 | menuButton->setMaximumWidth( 20 ); | 127 | menuButton->setMaximumWidth( 20 ); |
127 | menuButton->insertItem( s_addBookmark); | 128 | menuButton->insertItem( s_addBookmark); |
128 | menuButton->insertItem( s_removeBookmark); | 129 | menuButton->insertItem( s_removeBookmark); |
129 | menuButton->insertSeparator(); | 130 | menuButton->insertSeparator(); |
130 | menuButton->setFocusPolicy(NoFocus); | 131 | menuButton->setFocusPolicy(NoFocus); |
131 | CBHB->addWidget( menuButton ); | 132 | CBHB->addWidget( menuButton ); |
132 | 133 | ||
133 | customDirsToMenu(); | 134 | customDirsToMenu(); |
134 | 135 | ||
135 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 136 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
136 | currentPathCombo->setEditable(TRUE); | 137 | currentPathCombo->setEditable(TRUE); |
137 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 138 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
138 | currentPathCombo->setFocusPolicy(NoFocus); | 139 | currentPathCombo->setFocusPolicy(NoFocus); |
139 | CBHB->addWidget( currentPathCombo ); | 140 | CBHB->addWidget( currentPathCombo ); |
140 | 141 | ||
141 | layout->addLayout( CBHB ); | 142 | layout->addLayout( CBHB ); |
142 | 143 | ||
143 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 144 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
144 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 145 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
145 | layout->addWidget( TabWidget, 4 ); | 146 | layout->addWidget( TabWidget, 4 ); |
146 | 147 | ||
147 | tab = new QWidget( TabWidget, "tab" ); | 148 | tab = new QWidget( TabWidget, "tab" ); |
148 | tabLayout = new QGridLayout( tab ); | 149 | tabLayout = new QGridLayout( tab ); |
149 | tabLayout->setSpacing( 2); | 150 | tabLayout->setSpacing( 2); |
150 | tabLayout->setMargin( 2); | 151 | tabLayout->setMargin( 2); |
151 | 152 | ||
152 | Local_View = new QListView( tab, "Local_View" ); | 153 | Local_View = new QListView( tab, "Local_View" ); |
153 | Local_View->addColumn( tr("File"),130); | 154 | Local_View->addColumn( tr("File"),130); |
154 | Local_View->addColumn( tr("Size"),-1); | 155 | Local_View->addColumn( tr("Size"),-1); |
155 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 156 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
156 | Local_View->addColumn( tr("Date"),-1); | 157 | Local_View->addColumn( tr("Date"),-1); |
157 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 158 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
158 | Local_View->setAllColumnsShowFocus(TRUE); | 159 | Local_View->setAllColumnsShowFocus(TRUE); |
159 | Local_View->setMultiSelection( TRUE ); | 160 | Local_View->setMultiSelection( TRUE ); |
160 | Local_View->setSelectionMode(QListView::Extended); | 161 | Local_View->setSelectionMode(QListView::Extended); |
161 | Local_View->setFocusPolicy(StrongFocus); | 162 | Local_View->setFocusPolicy(StrongFocus); |
162 | Local_View->installEventFilter( this ); | 163 | Local_View->installEventFilter( this ); |
163 | 164 | ||
164 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); | 165 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); |
165 | 166 | ||
166 | tabLayout->addWidget( Local_View, 0, 0 ); | 167 | tabLayout->addWidget( Local_View, 0, 0 ); |
167 | 168 | ||
168 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 169 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
169 | // TabWidget->insertTab( tab, tr("1")); | 170 | // TabWidget->insertTab( tab, tr("1")); |
170 | 171 | ||
171 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 172 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
172 | tabLayout_2 = new QGridLayout( tab_2 ); | 173 | tabLayout_2 = new QGridLayout( tab_2 ); |
173 | tabLayout_2->setSpacing( 2); | 174 | tabLayout_2->setSpacing( 2); |
174 | tabLayout_2->setMargin( 2); | 175 | tabLayout_2->setMargin( 2); |
175 | 176 | ||
176 | Remote_View = new QListView( tab_2, "Remote_View" ); | 177 | Remote_View = new QListView( tab_2, "Remote_View" ); |
177 | Remote_View->addColumn( tr("File"),130); | 178 | Remote_View->addColumn( tr("File"),130); |
178 | Remote_View->addColumn( tr("Size"),-1); | 179 | Remote_View->addColumn( tr("Size"),-1); |
179 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 180 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
180 | Remote_View->addColumn( tr("Date"),-1); | 181 | Remote_View->addColumn( tr("Date"),-1); |
181 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 182 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
182 | Remote_View->setAllColumnsShowFocus(TRUE); | 183 | Remote_View->setAllColumnsShowFocus(TRUE); |
183 | Remote_View->setMultiSelection( TRUE ); | 184 | Remote_View->setMultiSelection( TRUE ); |
184 | Remote_View->setSelectionMode(QListView::Extended); | 185 | Remote_View->setSelectionMode(QListView::Extended); |
185 | Remote_View->setFocusPolicy(StrongFocus); | 186 | Remote_View->setFocusPolicy(StrongFocus); |
186 | Remote_View->installEventFilter( this ); | 187 | Remote_View->installEventFilter( this ); |
187 | 188 | ||
188 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); | 189 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); |
189 | 190 | ||
190 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 191 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
191 | 192 | ||
192 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 193 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
193 | TabWidget->setSizeChange( 370 ); | 194 | TabWidget->setSizeChange( 370 ); |
194 | // TabWidget->insertTab( tab_2, tr( "2")); | 195 | // TabWidget->insertTab( tab_2, tr( "2")); |
195 | 196 | ||
196 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 197 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
197 | tabLayout_3 = new QGridLayout( tab_3 ); | 198 | tabLayout_3 = new QGridLayout( tab_3 ); |
198 | tabLayout_3->setSpacing( 2); | 199 | tabLayout_3->setSpacing( 2); |
199 | tabLayout_3->setMargin( 2); | 200 | tabLayout_3->setMargin( 2); |
200 | 201 | ||
201 | 202 | ||
202 | // OFileDialog fileDialog; | 203 | // OFileDialog fileDialog; |
203 | // fileDialog; | 204 | // fileDialog; |
204 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 205 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
205 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 206 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
206 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 207 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
207 | 208 | ||
208 | QListView *fileTree; | 209 | QListView *fileTree; |
209 | fileTree = new QListView( tab_3, "tree" ); | 210 | fileTree = new QListView( tab_3, "tree" ); |
210 | 211 | ||
211 | 212 | ||
212 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 213 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
213 | 214 | ||
214 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 215 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
215 | */ | 216 | */ |
216 | 217 | ||
217 | /////////////// | 218 | /////////////// |
218 | 219 | ||
219 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 220 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
220 | zaurusDevice=TRUE; | 221 | zaurusDevice=TRUE; |
221 | else | 222 | else |
222 | zaurusDevice=FALSE; | 223 | zaurusDevice=FALSE; |
223 | 224 | ||
224 | 225 | ||
225 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 226 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
226 | odebug << "not have sd" << oendl; | 227 | odebug << "not have sd" << oendl; |
227 | sdButton->hide(); | 228 | sdButton->hide(); |
228 | } | 229 | } |
229 | if( !StorageInfo::hasCf() ) { | 230 | if( !StorageInfo::hasCf() ) { |
230 | odebug << "not have cf" << oendl; | 231 | odebug << "not have cf" << oendl; |
231 | cfButton->hide(); | 232 | cfButton->hide(); |
232 | } | 233 | } |
233 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 234 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
234 | currentDir.setPath( QDir::currentDirPath()); | 235 | currentDir.setPath( QDir::currentDirPath()); |
235 | 236 | ||
236 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 237 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
237 | currentRemoteDir.setPath( QDir::currentDirPath()); | 238 | currentRemoteDir.setPath( QDir::currentDirPath()); |
238 | 239 | ||
239 | // b = TRUE; | 240 | // b = TRUE; |
240 | 241 | ||
241 | filterStr="*"; | 242 | filterStr="*"; |
242 | showMenuHidden(); | 243 | showMenuHidden(); |
243 | TabWidget->setCurrentWidget(0); | 244 | TabWidget->setCurrentWidget(0); |
244 | 245 | ||
245 | } | 246 | } |
246 | 247 | ||
247 | void AdvancedFm::initConnections() | 248 | void AdvancedFm::initConnections() |
248 | { | 249 | { |
249 | 250 | ||
250 | connect( qApp,SIGNAL( aboutToQuit()), | 251 | connect( qApp,SIGNAL( aboutToQuit()), |
251 | this, SLOT( cleanUp()) ); | 252 | this, SLOT( cleanUp()) ); |
252 | connect( qpeDirButton ,SIGNAL(released()), | 253 | connect( qpeDirButton ,SIGNAL(released()), |
253 | this,SLOT( QPEButtonPushed()) ); | 254 | this,SLOT( QPEButtonPushed()) ); |
254 | connect( cfButton ,SIGNAL(released()), | 255 | connect( cfButton ,SIGNAL(released()), |
255 | this,SLOT( CFButtonPushed()) ); | 256 | this,SLOT( CFButtonPushed()) ); |
256 | connect( sdButton ,SIGNAL(released()), | 257 | connect( sdButton ,SIGNAL(released()), |
257 | this,SLOT( SDButtonPushed()) ); | 258 | this,SLOT( SDButtonPushed()) ); |
258 | connect( cdUpButton ,SIGNAL(released()), | 259 | connect( cdUpButton ,SIGNAL(released()), |
259 | this,SLOT( upDir()) ); | 260 | this,SLOT( upDir()) ); |
260 | connect( docButton,SIGNAL(released()), | 261 | connect( docButton,SIGNAL(released()), |
261 | this,SLOT( docButtonPushed()) ); | 262 | this,SLOT( docButtonPushed()) ); |
262 | connect( homeButton,SIGNAL(released()), | 263 | connect( homeButton,SIGNAL(released()), |
263 | this,SLOT( homeButtonPushed()) ); | 264 | this,SLOT( homeButtonPushed()) ); |
264 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 265 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
265 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 266 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
266 | 267 | ||
267 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 268 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
268 | this,SLOT(currentPathComboChanged())); | 269 | this,SLOT(currentPathComboChanged())); |
269 | 270 | ||
270 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 271 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
271 | this,SLOT( ListClicked(QListViewItem*)) ); | 272 | this,SLOT( ListClicked(QListViewItem*)) ); |
272 | 273 | ||
273 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 274 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
274 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 275 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
275 | 276 | ||
276 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | 277 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
277 | this,SLOT( ListClicked(QListViewItem*)) ); | 278 | this,SLOT( ListClicked(QListViewItem*)) ); |
278 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 279 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
279 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 280 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
280 | 281 | ||
281 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), | 282 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), |
282 | this,SLOT(tabChanged(QWidget*))); | 283 | this,SLOT(tabChanged(QWidget*))); |
283 | 284 | ||
284 | connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), | 285 | connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), |
285 | this, SLOT(showFileMenu())); | 286 | this, SLOT(showFileMenu())); |
286 | connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), | 287 | connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), |
287 | this, SLOT(showFileMenu())); | 288 | this, SLOT(showFileMenu())); |
288 | 289 | ||
289 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); | 290 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); |
290 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); | 291 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); |
291 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); | 292 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); |
292 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 293 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
293 | 294 | ||
294 | } | 295 | } |
295 | 296 | ||