author | llornkcor <llornkcor> | 2004-09-25 06:51:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 06:51:24 (UTC) |
commit | 3d4aef2df9828aedccf5d576ecbc8aad6621362e (patch) (unidiff) | |
tree | 435f8e3b658ef45d8e95d29a305d20c62e01c24e | |
parent | 448e2835ff7b84162022b62f8570935739a167bb (diff) | |
download | opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.zip opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.tar.gz opie-3d4aef2df9828aedccf5d576ecbc8aad6621362e.tar.bz2 |
not hardcoded path
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 2 |
3 files changed, 7 insertions, 37 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index ec7a08a..f1be471 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,554 +1,540 @@ | |||
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 <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | |||
17 | #include <opie2/ostorageinfo.h> | ||
18 | |||
16 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
17 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
18 | #include <qpe/mimetype.h> | 21 | #include <qpe/mimetype.h> |
19 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
20 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
21 | #include <qpe/menubutton.h> | 24 | #include <qpe/menubutton.h> |
22 | 25 | ||
23 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
24 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
25 | #include <qlistview.h> | 28 | #include <qlistview.h> |
26 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
27 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
28 | 31 | ||
29 | 32 | ||
30 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
31 | #include <time.h> | 34 | #include <time.h> |
32 | #include <dirent.h> | 35 | #include <dirent.h> |
33 | #include <fcntl.h> | 36 | #include <fcntl.h> |
34 | #include <sys/vfs.h> | 37 | #include <sys/vfs.h> |
35 | #include <mntent.h> | 38 | #include <mntent.h> |
36 | 39 | ||
37 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
38 | 41 | ||
39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 42 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
40 | : QMainWindow( ) { | 43 | : QMainWindow( ) { |
41 | init(); | 44 | init(); |
42 | renameBox = 0; | 45 | renameBox = 0; |
43 | 46 | ||
44 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); | 47 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); |
45 | 48 | ||
46 | initConnections(); | 49 | initConnections(); |
47 | rePopulate(); | 50 | rePopulate(); |
48 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
49 | connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); | 52 | connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); |
50 | switchToLocalTab(); | 53 | switchToLocalTab(); |
51 | } | 54 | } |
52 | 55 | ||
53 | AdvancedFm::~AdvancedFm() { | 56 | AdvancedFm::~AdvancedFm() { |
54 | } | 57 | } |
55 | 58 | ||
56 | 59 | ||
57 | void AdvancedFm::cleanUp() { | 60 | void AdvancedFm::cleanUp() { |
58 | QString sfile=QDir::homeDirPath(); | 61 | QString sfile=QDir::homeDirPath(); |
59 | if(sfile.right(1) != "/") | 62 | if(sfile.right(1) != "/") |
60 | sfile+="/._temp"; | 63 | sfile+="/._temp"; |
61 | else | 64 | else |
62 | sfile+="._temp"; | 65 | sfile+="._temp"; |
63 | QFile file( sfile); | 66 | QFile file( sfile); |
64 | if(file.exists()) | 67 | if(file.exists()) |
65 | file.remove(); | 68 | file.remove(); |
66 | } | 69 | } |
67 | 70 | ||
68 | void AdvancedFm::tabChanged(QWidget *wd) { | 71 | void AdvancedFm::tabChanged(QWidget *wd) { |
69 | // qDebug("tabChanged"); | 72 | // qDebug("tabChanged"); |
70 | if(wd == tab) { | 73 | if(wd == tab) { |
71 | whichTab = 1; | 74 | whichTab = 1; |
72 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); | 75 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); |
73 | } | 76 | } |
74 | else if(wd == tab_2) { | 77 | else if(wd == tab_2) { |
75 | whichTab = 2; | 78 | whichTab = 2; |
76 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); | 79 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); |
77 | } | 80 | } |
78 | qApp->processEvents(); | 81 | qApp->processEvents(); |
79 | QString path = CurrentDir()->canonicalPath(); | 82 | QString path = CurrentDir()->canonicalPath(); |
80 | // qDebug(path); | 83 | // qDebug(path); |
81 | if ( TabWidget->currentWidget() == tab) { | 84 | if ( TabWidget->currentWidget() == tab) { |
82 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 85 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
83 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 86 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
84 | } else { | 87 | } else { |
85 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 88 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
86 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 89 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
87 | } | 90 | } |
88 | 91 | ||
89 | QString fs= getFileSystemType( (const QString &) path); | 92 | QString fs= getFileSystemType( (const QString &) path); |
90 | 93 | ||
91 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 94 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
92 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 95 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
93 | chdir( path.latin1()); | 96 | chdir( path.latin1()); |
94 | currentPathCombo->lineEdit()->setText(path); | 97 | currentPathCombo->lineEdit()->setText(path); |
95 | } | 98 | } |
96 | 99 | ||
97 | 100 | ||
98 | void AdvancedFm::populateView() { | 101 | void AdvancedFm::populateView() { |
99 | 102 | ||
100 | QPixmap pm; | 103 | QPixmap pm; |
101 | QListView *thisView = CurrentView(); | 104 | QListView *thisView = CurrentView(); |
102 | QDir *thisDir = CurrentDir(); | 105 | QDir *thisDir = CurrentDir(); |
103 | QString path = thisDir->canonicalPath(); | 106 | QString path = thisDir->canonicalPath(); |
104 | 107 | ||
105 | thisView->clear(); | 108 | thisView->clear(); |
106 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 109 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
107 | thisDir->setMatchAllDirs(TRUE); | 110 | thisDir->setMatchAllDirs(TRUE); |
108 | thisDir->setNameFilter(filterStr); | 111 | thisDir->setNameFilter(filterStr); |
109 | QString fileL, fileS, fileDate; | 112 | QString fileL, fileS, fileDate; |
110 | QString fs= getFileSystemType((const QString &) path); | 113 | QString fs= getFileSystemType((const QString &) path); |
111 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 114 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
112 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 115 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
113 | bool isDir=FALSE; | 116 | bool isDir=FALSE; |
114 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 117 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
115 | QFileInfoListIterator it(*list); | 118 | QFileInfoListIterator it(*list); |
116 | QFileInfo *fi; | 119 | QFileInfo *fi; |
117 | while ( (fi=it.current()) ) { | 120 | while ( (fi=it.current()) ) { |
118 | if (fi->isSymLink() ) { | 121 | if (fi->isSymLink() ) { |
119 | QString symLink=fi->readLink(); | 122 | QString symLink=fi->readLink(); |
120 | QFileInfo sym( symLink); | 123 | QFileInfo sym( symLink); |
121 | fileS.sprintf( "%10i", sym.size() ); | 124 | fileS.sprintf( "%10i", sym.size() ); |
122 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 125 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
123 | fileDate = sym.lastModified().toString(); | 126 | fileDate = sym.lastModified().toString(); |
124 | } else { | 127 | } else { |
125 | fileS.sprintf( "%10i", fi->size() ); | 128 | fileS.sprintf( "%10i", fi->size() ); |
126 | fileL = fi->fileName(); | 129 | fileL = fi->fileName(); |
127 | fileDate= fi->lastModified().toString(); | 130 | fileDate= fi->lastModified().toString(); |
128 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 131 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
129 | // if(fileL == "..") | 132 | // if(fileL == "..") |
130 | fileL += "/"; | 133 | fileL += "/"; |
131 | isDir=TRUE; | 134 | isDir=TRUE; |
132 | } | 135 | } |
133 | } | 136 | } |
134 | QFileInfo fileInfo( path + "/" + fileL); | 137 | QFileInfo fileInfo( path + "/" + fileL); |
135 | 138 | ||
136 | if(fileL !="./" && fi->exists()) { | 139 | if(fileL !="./" && fi->exists()) { |
137 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 140 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
138 | 141 | ||
139 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 142 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
140 | 143 | ||
141 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 144 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
142 | pm = Resource::loadPixmap( "lockedfolder" ); | 145 | pm = Resource::loadPixmap( "lockedfolder" ); |
143 | else | 146 | else |
144 | pm= Resource::loadPixmap( "folder" ); | 147 | pm= Resource::loadPixmap( "folder" ); |
145 | } | 148 | } |
146 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 149 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
147 | pm = Resource::loadPixmap( "exec"); | 150 | pm = Resource::loadPixmap( "exec"); |
148 | } | 151 | } |
149 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 152 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
150 | | fileInfo.permission( QFileInfo::ExeGroup) | 153 | | fileInfo.permission( QFileInfo::ExeGroup) |
151 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 154 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
152 | pm = Resource::loadPixmap( "exec"); | 155 | pm = Resource::loadPixmap( "exec"); |
153 | } | 156 | } |
154 | else if( !fi->isReadable() ) { | 157 | else if( !fi->isReadable() ) { |
155 | pm = Resource::loadPixmap( "locked" ); | 158 | pm = Resource::loadPixmap( "locked" ); |
156 | } | 159 | } |
157 | else { //everything else goes by mimetype | 160 | else { //everything else goes by mimetype |
158 | MimeType mt(fi->filePath()); | 161 | MimeType mt(fi->filePath()); |
159 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 162 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
160 | if(pm.isNull()) { | 163 | if(pm.isNull()) { |
161 | pm = unknownXpm; | 164 | pm = unknownXpm; |
162 | } | 165 | } |
163 | } | 166 | } |
164 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 167 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
165 | // odebug << " overlay link image" << oendl; | 168 | // odebug << " overlay link image" << oendl; |
166 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 169 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
167 | // pm= Resource::loadPixmap( "folder" ); | 170 | // pm= Resource::loadPixmap( "folder" ); |
168 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 171 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
169 | // QPainter painter( &pm ); | 172 | // QPainter painter( &pm ); |
170 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 173 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
171 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 174 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
172 | } | 175 | } |
173 | item->setPixmap( 0,pm); | 176 | item->setPixmap( 0,pm); |
174 | 177 | ||
175 | } | 178 | } |
176 | isDir=FALSE; | 179 | isDir=FALSE; |
177 | ++it; | 180 | ++it; |
178 | } | 181 | } |
179 | 182 | ||
180 | if( path.find("dev",0,TRUE) != -1) { | 183 | if( path.find("dev",0,TRUE) != -1) { |
181 | struct stat buf; | 184 | struct stat buf; |
182 | dev_t devT; | 185 | dev_t devT; |
183 | DIR *dir; | 186 | DIR *dir; |
184 | struct dirent *mydirent; | 187 | struct dirent *mydirent; |
185 | 188 | ||
186 | if((dir = opendir( path.latin1())) != NULL) | 189 | if((dir = opendir( path.latin1())) != NULL) |
187 | while ((mydirent = readdir(dir)) != NULL) { | 190 | while ((mydirent = readdir(dir)) != NULL) { |
188 | lstat( mydirent->d_name, &buf); | 191 | lstat( mydirent->d_name, &buf); |
189 | // odebug << mydirent->d_name << oendl; | 192 | // odebug << mydirent->d_name << oendl; |
190 | fileL.sprintf("%s", mydirent->d_name); | 193 | fileL.sprintf("%s", mydirent->d_name); |
191 | devT = buf.st_dev; | 194 | devT = buf.st_dev; |
192 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 195 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
193 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 196 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
194 | if( fileL.find(".") == -1 ) { | 197 | if( fileL.find(".") == -1 ) { |
195 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 198 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
196 | pm = unknownXpm; | 199 | pm = unknownXpm; |
197 | item->setPixmap( 0,pm); | 200 | item->setPixmap( 0,pm); |
198 | } | 201 | } |
199 | } | 202 | } |
200 | 203 | ||
201 | closedir(dir); | 204 | closedir(dir); |
202 | } | 205 | } |
203 | 206 | ||
204 | thisView->setSorting( 3,FALSE); | 207 | thisView->setSorting( 3,FALSE); |
205 | fillCombo( (const QString &) path ); | 208 | fillCombo( (const QString &) path ); |
206 | } | 209 | } |
207 | 210 | ||
208 | void AdvancedFm::rePopulate() { | 211 | void AdvancedFm::rePopulate() { |
209 | // qDebug("repopulate views"); | 212 | // qDebug("repopulate views"); |
210 | populateView(); | 213 | populateView(); |
211 | setOtherTabCurrent(); | 214 | setOtherTabCurrent(); |
212 | populateView(); | 215 | populateView(); |
213 | |||
214 | // int tmpTab = whichTab; | ||
215 | // // odebug << "" << tmpTab << "" << oendl; | ||
216 | |||
217 | // for(int i =1; i < 3; i++) { | ||
218 | // TabWidget->setCurrentWidget(i - 1); | ||
219 | // populateView(); | ||
220 | // } | ||
221 | // TabWidget->setCurrentWidget( tmpTab - 1); | ||
222 | } | 216 | } |
223 | 217 | ||
224 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 218 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
225 | // if ( TabWidget->currentWidget() == tab) | ||
226 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); | ||
227 | // else | ||
228 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); | ||
229 | |||
230 | |||
231 | if(selectedItem) { | 219 | if(selectedItem) { |
232 | QString strItem=selectedItem->text(0); | 220 | QString strItem=selectedItem->text(0); |
233 | // owarn << strItem << oendl; | 221 | // owarn << strItem << oendl; |
234 | QString strSize=selectedItem->text(1); | 222 | QString strSize=selectedItem->text(1); |
235 | strSize=strSize.stripWhiteSpace(); | 223 | strSize=strSize.stripWhiteSpace(); |
236 | bool isDirectory = false; | 224 | bool isDirectory = false; |
237 | QString strItem2; | 225 | QString strItem2; |
238 | 226 | ||
239 | 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 |
240 | strItem2 = dealWithSymName((const QString&)strItem); | 228 | strItem2 = dealWithSymName((const QString&)strItem); |
241 | if(QDir(strItem2).exists() ) | 229 | if(QDir(strItem2).exists() ) |
242 | strItem = strItem2; | 230 | strItem = strItem2; |
243 | } | 231 | } |
244 | 232 | ||
245 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 233 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
246 | 234 | ||
247 | if(QDir(strItem).exists()) | 235 | if(QDir(strItem).exists()) |
248 | isDirectory = true; | 236 | isDirectory = true; |
249 | } | 237 | } |
250 | 238 | ||
251 | if( isDirectory ) { | 239 | if( isDirectory ) { |
252 | CurrentDir()->cd( strItem, TRUE); | 240 | CurrentDir()->cd( strItem, TRUE); |
253 | populateView(); | 241 | populateView(); |
254 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 242 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
255 | } | 243 | } |
256 | chdir( strItem.latin1()); | 244 | chdir( strItem.latin1()); |
257 | } | 245 | } |
258 | } | 246 | } |
259 | 247 | ||
260 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 248 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
261 | Q_UNUSED(item); | 249 | Q_UNUSED(item); |
262 | switch (mouse) { | 250 | switch (mouse) { |
263 | case 1: | 251 | case 1: |
264 | { | 252 | { |
265 | if(renameBox != 0 ) { | 253 | if(renameBox != 0 ) { |
266 | cancelRename(); | 254 | cancelRename(); |
267 | } | 255 | } |
268 | } | 256 | } |
269 | break; | 257 | break; |
270 | // case 2: | 258 | // case 2: |
271 | // menuTimer.start( 50, TRUE ); | 259 | // menuTimer.start( 50, TRUE ); |
272 | // break; | 260 | // break; |
273 | }; | 261 | }; |
274 | } | 262 | } |
275 | 263 | ||
276 | 264 | ||
277 | void AdvancedFm::refreshCurrentTab() { | 265 | void AdvancedFm::refreshCurrentTab() { |
278 | populateView(); | 266 | populateView(); |
279 | // if ( TabWidget->currentWidget() == tab) { | 267 | // if ( TabWidget->currentWidget() == tab) { |
280 | |||
281 | } | 268 | } |
282 | 269 | ||
283 | void AdvancedFm::switchToLocalTab() { | 270 | void AdvancedFm::switchToLocalTab() { |
284 | TabWidget->setCurrentWidget(0); | 271 | TabWidget->setCurrentWidget(0); |
285 | // Local_View->setFocus(); | 272 | // Local_View->setFocus(); |
286 | whichTab = 1; | 273 | whichTab = 1; |
287 | } | 274 | } |
288 | 275 | ||
289 | void AdvancedFm::switchToRemoteTab() { | 276 | void AdvancedFm::switchToRemoteTab() { |
290 | TabWidget->setCurrentWidget(1); | 277 | TabWidget->setCurrentWidget(1); |
291 | // Remote_View->setFocus(); | 278 | // Remote_View->setFocus(); |
292 | whichTab = 2; | 279 | whichTab = 2; |
293 | } | 280 | } |
294 | 281 | ||
295 | void AdvancedFm::currentPathComboChanged() { | 282 | void AdvancedFm::currentPathComboChanged() { |
296 | QString pDir = currentPathCombo->lineEdit()->text(); | 283 | QString pDir = currentPathCombo->lineEdit()->text(); |
297 | if(QDir(pDir).exists()) { | 284 | if(QDir(pDir).exists()) { |
298 | CurrentDir()->setPath(pDir ); | 285 | CurrentDir()->setPath(pDir ); |
299 | populateView(); | 286 | populateView(); |
300 | } else { | 287 | } else { |
301 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); | 288 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); |
302 | } | 289 | } |
303 | } | 290 | } |
304 | 291 | ||
305 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 292 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
306 | 293 | ||
307 | if ( TabWidget->currentWidget() == tab) { | 294 | if ( TabWidget->currentWidget() == tab) { |
308 | // if ( whichTab == 1) { | 295 | // if ( whichTab == 1) { |
309 | currentPathCombo->lineEdit()->setText( currentPath); | 296 | currentPathCombo->lineEdit()->setText( currentPath); |
310 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 297 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
311 | currentPathCombo->clear(); | 298 | currentPathCombo->clear(); |
312 | localDirPathStringList.prepend( currentPath ); | 299 | localDirPathStringList.prepend( currentPath ); |
313 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 300 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
314 | } | 301 | } |
315 | } else { | 302 | } else { |
316 | currentPathCombo->lineEdit()->setText( currentPath); | 303 | currentPathCombo->lineEdit()->setText( currentPath); |
317 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 304 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
318 | currentPathCombo->clear(); | 305 | currentPathCombo->clear(); |
319 | remoteDirPathStringList.prepend( currentPath ); | 306 | remoteDirPathStringList.prepend( currentPath ); |
320 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 307 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
321 | } | 308 | } |
322 | } | 309 | } |
323 | } | 310 | } |
324 | 311 | ||
325 | QStringList AdvancedFm::getPath() { | 312 | QStringList AdvancedFm::getPath() { |
326 | QStringList strList; | 313 | QStringList strList; |
327 | QListView *thisView=CurrentView(); | 314 | QListView *thisView=CurrentView(); |
328 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 315 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
329 | QListViewItemIterator it( thisView ); | 316 | QListViewItemIterator it( thisView ); |
330 | for ( ; it.current(); ++it ) { | 317 | for ( ; it.current(); ++it ) { |
331 | if ( it.current()->isSelected() ) { | 318 | if ( it.current()->isSelected() ) { |
332 | strList << it.current()->text(0); | 319 | strList << it.current()->text(0); |
333 | // odebug << it.current()->text(0) << oendl; | 320 | // odebug << it.current()->text(0) << oendl; |
334 | } | 321 | } |
335 | } | 322 | } |
336 | return strList; | 323 | return strList; |
337 | } | 324 | } |
338 | 325 | ||
339 | void AdvancedFm::changeTo(const QString dir) { | 326 | void AdvancedFm::changeTo(const QString dir) { |
340 | chdir( dir.latin1()); | 327 | chdir( dir.latin1()); |
341 | CurrentDir()->cd(dir, TRUE); | 328 | CurrentDir()->cd(dir, TRUE); |
342 | populateView(); | 329 | populateView(); |
343 | update(); | 330 | update(); |
344 | } | 331 | } |
345 | 332 | ||
346 | void AdvancedFm::homeButtonPushed() { | 333 | void AdvancedFm::homeButtonPushed() { |
347 | changeTo(QDir::homeDirPath()); | 334 | changeTo(QDir::homeDirPath()); |
348 | } | 335 | } |
349 | 336 | ||
350 | void AdvancedFm::docButtonPushed() { | 337 | void AdvancedFm::docButtonPushed() { |
351 | changeTo(QPEApplication::documentDir()); | 338 | changeTo(QPEApplication::documentDir()); |
352 | } | 339 | } |
353 | 340 | ||
354 | void AdvancedFm::SDButtonPushed() { | 341 | void AdvancedFm::SDButtonPushed() { |
355 | changeTo("/mnt/card");// this can change so fix | 342 | Opie::Core::OStorageInfo info; |
343 | changeTo(info.sdPath()); | ||
356 | } | 344 | } |
357 | 345 | ||
358 | void AdvancedFm::CFButtonPushed() { | 346 | void AdvancedFm::CFButtonPushed() { |
359 | if(zaurusDevice) | 347 | Opie::Core::OStorageInfo info; |
360 | changeTo("/mnt/cf"); //zaurus | 348 | changeTo(info.cfPath()); |
361 | else | ||
362 | changeTo("/mnt/hda"); //ipaq | ||
363 | } | 349 | } |
364 | 350 | ||
365 | void AdvancedFm::QPEButtonPushed() { | 351 | void AdvancedFm::QPEButtonPushed() { |
366 | changeTo(QPEApplication::qpeDir()); | 352 | changeTo(QPEApplication::qpeDir()); |
367 | } | 353 | } |
368 | 354 | ||
369 | void AdvancedFm::doAbout() { | 355 | void AdvancedFm::doAbout() { |
370 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); | 356 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); |
371 | } | 357 | } |
372 | 358 | ||
373 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 359 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
374 | Q_UNUSED(e); | 360 | Q_UNUSED(e); |
375 | } | 361 | } |
376 | 362 | ||
377 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 363 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
378 | // if( CurrentView()->hasFocus() ) | 364 | // if( CurrentView()->hasFocus() ) |
379 | // e->ignore(); | 365 | // e->ignore(); |
380 | if( currentPathCombo->lineEdit()->hasFocus()) { | 366 | if( currentPathCombo->lineEdit()->hasFocus()) { |
381 | // qDebug("shout!"); | 367 | // qDebug("shout!"); |
382 | } | 368 | } |
383 | 369 | ||
384 | else if( e->key() == Key_Left ) | 370 | else if( e->key() == Key_Left ) |
385 | upDir(); | 371 | upDir(); |
386 | else if( e->key() == Key_Return || e->key() == Key_Enter) | 372 | else if( e->key() == Key_Return || e->key() == Key_Enter) |
387 | navigateToSelected(); | 373 | navigateToSelected(); |
388 | else if( e->key() == Key_Tab) | 374 | else if( e->key() == Key_Tab) |
389 | setOtherTabCurrent(); | 375 | setOtherTabCurrent(); |
390 | else if( e->key() == Key_Delete ) | 376 | else if( e->key() == Key_Delete ) |
391 | del(); | 377 | del(); |
392 | else if( e->key() == Key_A) | 378 | else if( e->key() == Key_A) |
393 | copyAs(); | 379 | copyAs(); |
394 | else if( e->key() == Key_C) | 380 | else if( e->key() == Key_C) |
395 | copy(); | 381 | copy(); |
396 | else if( e->key() == Key_E) | 382 | else if( e->key() == Key_E) |
397 | runThis(); | 383 | runThis(); |
398 | else if( e->key() == Key_G) | 384 | else if( e->key() == Key_G) |
399 | currentPathCombo->lineEdit()->setFocus(); | 385 | currentPathCombo->lineEdit()->setFocus(); |
400 | else if( e->key() == Key_H ) | 386 | else if( e->key() == Key_H ) |
401 | showHidden(); | 387 | showHidden(); |
402 | else if( e->key() == Key_I) | 388 | else if( e->key() == Key_I) |
403 | fileStatus(); | 389 | fileStatus(); |
404 | else if( e->key() == Key_M) | 390 | else if( e->key() == Key_M) |
405 | move(); | 391 | move(); |
406 | else if( e->key() == Key_N ) | 392 | else if( e->key() == Key_N ) |
407 | mkDir(); | 393 | mkDir(); |
408 | else if( e->key() == Key_P) | 394 | else if( e->key() == Key_P) |
409 | filePerms(); | 395 | filePerms(); |
410 | else if( e->key() == Key_R ) | 396 | else if( e->key() == Key_R ) |
411 | rn(); | 397 | rn(); |
412 | else if( e->key() == Key_U ) | 398 | else if( e->key() == Key_U ) |
413 | upDir(); | 399 | upDir(); |
414 | else if( e->key() == Key_1) | 400 | else if( e->key() == Key_1) |
415 | switchToLocalTab(); | 401 | switchToLocalTab(); |
416 | else if( e->key() == Key_2) | 402 | else if( e->key() == Key_2) |
417 | switchToRemoteTab(); | 403 | switchToRemoteTab(); |
418 | else if( e->key() == Key_3) | 404 | else if( e->key() == Key_3) |
419 | CFButtonPushed(); | 405 | CFButtonPushed(); |
420 | else if( e->key() == Key_4) | 406 | else if( e->key() == Key_4) |
421 | SDButtonPushed(); | 407 | SDButtonPushed(); |
422 | else if( e->key() == Key_5 ) | 408 | else if( e->key() == Key_5 ) |
423 | homeButtonPushed(); | 409 | homeButtonPushed(); |
424 | else if( e->key() == Key_6 ) | 410 | else if( e->key() == Key_6 ) |
425 | docButtonPushed(); | 411 | docButtonPushed(); |
426 | else | 412 | else |
427 | e->accept(); | 413 | e->accept(); |
428 | } | 414 | } |
429 | 415 | ||
430 | 416 | ||
431 | void AdvancedFm::parsetab(const QString &fileName) { | 417 | void AdvancedFm::parsetab(const QString &fileName) { |
432 | 418 | ||
433 | fileSystemTypeList.clear(); | 419 | fileSystemTypeList.clear(); |
434 | fsList.clear(); | 420 | fsList.clear(); |
435 | struct mntent *me; | 421 | struct mntent *me; |
436 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 422 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
437 | if ( mntfp ) { | 423 | if ( mntfp ) { |
438 | while ( (me = getmntent( mntfp )) != 0 ) { | 424 | while ( (me = getmntent( mntfp )) != 0 ) { |
439 | QString deviceName = me->mnt_fsname; | 425 | QString deviceName = me->mnt_fsname; |
440 | QString filesystemType = me->mnt_type; | 426 | QString filesystemType = me->mnt_type; |
441 | QString mountDir = me->mnt_dir; | 427 | QString mountDir = me->mnt_dir; |
442 | if(deviceName != "none") { | 428 | if(deviceName != "none") { |
443 | if( fsList.contains(filesystemType) == 0 | 429 | if( fsList.contains(filesystemType) == 0 |
444 | & filesystemType.find("proc",0,TRUE) == -1 | 430 | & filesystemType.find("proc",0,TRUE) == -1 |
445 | & filesystemType.find("cramfs",0,TRUE) == -1 | 431 | & filesystemType.find("cramfs",0,TRUE) == -1 |
446 | & filesystemType.find("auto",0,TRUE) == -1) | 432 | & filesystemType.find("auto",0,TRUE) == -1) |
447 | fsList << filesystemType; | 433 | fsList << filesystemType; |
448 | fileSystemTypeList << mountDir+"::"+filesystemType; | 434 | fileSystemTypeList << mountDir+"::"+filesystemType; |
449 | } | 435 | } |
450 | } | 436 | } |
451 | } | 437 | } |
452 | endmntent( mntfp ); | 438 | endmntent( mntfp ); |
453 | } | 439 | } |
454 | 440 | ||
455 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 441 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
456 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 442 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
457 | QString current = currentText;//.right( currentText.length()-1); | 443 | QString current = currentText;//.right( currentText.length()-1); |
458 | QString baseFs; | 444 | QString baseFs; |
459 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 445 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
460 | QString temp = (*it); | 446 | QString temp = (*it); |
461 | QString path = temp.left(temp.find("::",0,TRUE) ); | 447 | QString path = temp.left(temp.find("::",0,TRUE) ); |
462 | path = path.right( path.length()-1); | 448 | path = path.right( path.length()-1); |
463 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 449 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
464 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 450 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
465 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 451 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
466 | } | 452 | } |
467 | } | 453 | } |
468 | return baseFs; | 454 | return baseFs; |
469 | } | 455 | } |
470 | 456 | ||
471 | QString AdvancedFm::getDiskSpace( const QString &path) { | 457 | QString AdvancedFm::getDiskSpace( const QString &path) { |
472 | struct statfs fss; | 458 | struct statfs fss; |
473 | if ( !statfs( path.latin1(), &fss ) ) { | 459 | if ( !statfs( path.latin1(), &fss ) ) { |
474 | int blkSize = fss.f_bsize; | 460 | int blkSize = fss.f_bsize; |
475 | // int totalBlks = fs.f_blocks; | 461 | // int totalBlks = fs.f_blocks; |
476 | int availBlks = fss.f_bavail; | 462 | int availBlks = fss.f_bavail; |
477 | 463 | ||
478 | long mult = blkSize / 1024; | 464 | long mult = blkSize / 1024; |
479 | long div = 1024 / blkSize; | 465 | long div = 1024 / blkSize; |
480 | if ( !mult ) mult = 1; | 466 | if ( !mult ) mult = 1; |
481 | if ( !div ) div = 1; | 467 | if ( !div ) div = 1; |
482 | 468 | ||
483 | return QString::number(availBlks * mult / div); | 469 | return QString::number(availBlks * mult / div); |
484 | } | 470 | } |
485 | return ""; | 471 | return ""; |
486 | } | 472 | } |
487 | 473 | ||
488 | 474 | ||
489 | void AdvancedFm::showFileMenu() { | 475 | void AdvancedFm::showFileMenu() { |
490 | QString curApp; | 476 | QString curApp; |
491 | curApp = CurrentView()->currentItem()->text(0); | 477 | curApp = CurrentView()->currentItem()->text(0); |
492 | 478 | ||
493 | MimeType mt(curApp); | 479 | MimeType mt(curApp); |
494 | const AppLnk* app = mt.application(); | 480 | const AppLnk* app = mt.application(); |
495 | QFile fi(curApp); | 481 | QFile fi(curApp); |
496 | QPopupMenu *m = new QPopupMenu(0); | 482 | QPopupMenu *m = new QPopupMenu(0); |
497 | QPopupMenu *n = new QPopupMenu(0); | 483 | QPopupMenu *n = new QPopupMenu(0); |
498 | // QPopupMenu *o = new QPopupMenu(0); | 484 | // QPopupMenu *o = new QPopupMenu(0); |
499 | m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); | 485 | m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); |
500 | 486 | ||
501 | if ( QFileInfo(fi).isDir()) { | 487 | if ( QFileInfo(fi).isDir()) { |
502 | m->insertSeparator(); | 488 | m->insertSeparator(); |
503 | m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); | 489 | m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); |
504 | } else { | 490 | } else { |
505 | 491 | ||
506 | if (app) | 492 | if (app) |
507 | m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); | 493 | m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); |
508 | else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 494 | else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
509 | m->insertItem(tr("Execute"),this,SLOT(runThis())); | 495 | m->insertItem(tr("Execute"),this,SLOT(runThis())); |
510 | m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); | 496 | m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); |
511 | } | 497 | } |
512 | 498 | ||
513 | m->insertItem(tr("Actions"),n); | 499 | m->insertItem(tr("Actions"),n); |
514 | n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); | 500 | n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); |
515 | 501 | ||
516 | n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); | 502 | n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); |
517 | 503 | ||
518 | n->insertSeparator(); | 504 | n->insertSeparator(); |
519 | n->insertItem(tr("Rename"),this,SLOT(renameIt())); | 505 | n->insertItem(tr("Rename"),this,SLOT(renameIt())); |
520 | 506 | ||
521 | n->insertItem(tr("Copy"),this,SLOT(copyTimer())); | 507 | n->insertItem(tr("Copy"),this,SLOT(copyTimer())); |
522 | n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); | 508 | n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); |
523 | n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); | 509 | n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); |
524 | n->insertItem(tr("Move"),this,SLOT(moveTimer())); | 510 | n->insertItem(tr("Move"),this,SLOT(moveTimer())); |
525 | 511 | ||
526 | n->insertSeparator(); | 512 | n->insertSeparator(); |
527 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); | 513 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); |
528 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); | 514 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); |
529 | 515 | ||
530 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); | 516 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); |
531 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); | 517 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); |
532 | 518 | ||
533 | m->insertSeparator(); | 519 | m->insertSeparator(); |
534 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); | 520 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); |
535 | 521 | ||
536 | #if defined(QT_QWS_OPIE) | 522 | #if defined(QT_QWS_OPIE) |
537 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); | 523 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); |
538 | #endif | 524 | #endif |
539 | m->setCheckable(TRUE); | 525 | m->setCheckable(TRUE); |
540 | if (!b) | 526 | if (!b) |
541 | m->setItemChecked(m->idAt(0),TRUE); | 527 | m->setItemChecked(m->idAt(0),TRUE); |
542 | else | 528 | else |
543 | m->setItemChecked(m->idAt(0),FALSE); | 529 | m->setItemChecked(m->idAt(0),FALSE); |
544 | 530 | ||
545 | if(Ir::supported()) | 531 | if(Ir::supported()) |
546 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); | 532 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); |
547 | m->setFocus(); | 533 | m->setFocus(); |
548 | 534 | ||
549 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); | 535 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); |
550 | 536 | ||
551 | if(m) delete m; | 537 | if(m) delete m; |
552 | } | 538 | } |
553 | 539 | ||
554 | 540 | ||
@@ -581,218 +567,205 @@ void AdvancedFm::addToDocs() { | |||
581 | // odebug << curFile << oendl; | 567 | // odebug << curFile << oendl; |
582 | QFileInfo fi(curFile); | 568 | QFileInfo fi(curFile); |
583 | DocLnk f; | 569 | DocLnk f; |
584 | // curFile.replace(QRegExp("\\..*"),""); | 570 | // curFile.replace(QRegExp("\\..*"),""); |
585 | f.setName(fi.baseName() ); | 571 | f.setName(fi.baseName() ); |
586 | f.setFile( curFile); | 572 | f.setFile( curFile); |
587 | f.writeLink(); | 573 | f.writeLink(); |
588 | } | 574 | } |
589 | } | 575 | } |
590 | } | 576 | } |
591 | 577 | ||
592 | 578 | ||
593 | void AdvancedFm::customDirsToMenu() { | 579 | void AdvancedFm::customDirsToMenu() { |
594 | 580 | ||
595 | Config cfg("AdvancedFm"); | 581 | Config cfg("AdvancedFm"); |
596 | cfg.setGroup("Menu"); | 582 | cfg.setGroup("Menu"); |
597 | 583 | ||
598 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 584 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
599 | menuButton->insertItems(list ); | 585 | menuButton->insertItems(list ); |
600 | 586 | ||
601 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 587 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
602 | // { | 588 | // { |
603 | // customDirMenu->insertItem(*it ); | 589 | // customDirMenu->insertItem(*it ); |
604 | // } | 590 | // } |
605 | } | 591 | } |
606 | 592 | ||
607 | void AdvancedFm::dirMenuSelected(int item) { | 593 | void AdvancedFm::dirMenuSelected(int item) { |
608 | switch(item) | 594 | switch(item) |
609 | { | 595 | { |
610 | 596 | ||
611 | case -21: | 597 | case -21: |
612 | case 0: | 598 | case 0: |
613 | addCustomDir(); | 599 | addCustomDir(); |
614 | break; | 600 | break; |
615 | case -22: | 601 | case -22: |
616 | case 1: | 602 | case 1: |
617 | removeCustomDir(); | 603 | removeCustomDir(); |
618 | break; | 604 | break; |
619 | default: | 605 | default: |
620 | { | 606 | { |
621 | // gotoCustomDir( menuButton->text(item)); | 607 | // gotoCustomDir( menuButton->text(item)); |
622 | // gotoCustomDir( customDirMenu->text(item)); | 608 | // gotoCustomDir( customDirMenu->text(item)); |
623 | } | 609 | } |
624 | break; | 610 | break; |
625 | 611 | ||
626 | }; | 612 | }; |
627 | } | 613 | } |
628 | 614 | ||
629 | void AdvancedFm::addCustomDir() { | 615 | void AdvancedFm::addCustomDir() { |
630 | Config cfg("AdvancedFm"); | 616 | Config cfg("AdvancedFm"); |
631 | cfg.setGroup("Menu"); | 617 | cfg.setGroup("Menu"); |
632 | QString dir; | 618 | QString dir; |
633 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 619 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
634 | 620 | ||
635 | dir = CurrentDir()->canonicalPath(); | 621 | dir = CurrentDir()->canonicalPath(); |
636 | 622 | ||
637 | bool addIt=true; | 623 | bool addIt=true; |
638 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 624 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
639 | if( dir == (*it)) { | 625 | if( dir == (*it)) { |
640 | addIt=false; | 626 | addIt=false; |
641 | } | 627 | } |
642 | } | 628 | } |
643 | if(addIt) { | 629 | if(addIt) { |
644 | menuButton->insertItem(dir); | 630 | menuButton->insertItem(dir); |
645 | // customDirMenu->insertItem(dir); | 631 | // customDirMenu->insertItem(dir); |
646 | list << dir; | 632 | list << dir; |
647 | } | 633 | } |
648 | 634 | ||
649 | cfg.writeEntry("CustomDir", list, ','); | 635 | cfg.writeEntry("CustomDir", list, ','); |
650 | cfg.write(); | 636 | cfg.write(); |
651 | } | 637 | } |
652 | 638 | ||
653 | void AdvancedFm::removeCustomDir() { | 639 | void AdvancedFm::removeCustomDir() { |
654 | // odebug << "remove custom dir" << oendl; | 640 | // odebug << "remove custom dir" << oendl; |
655 | Config cfg("AdvancedFm"); | 641 | Config cfg("AdvancedFm"); |
656 | cfg.setGroup("Menu"); | 642 | cfg.setGroup("Menu"); |
657 | QString dir; | 643 | QString dir; |
658 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 644 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
659 | QStringList list2; | 645 | QStringList list2; |
660 | dir = CurrentDir()->canonicalPath(); | 646 | dir = CurrentDir()->canonicalPath(); |
661 | int ramble=2; | 647 | int ramble=2; |
662 | // int ramble=-24; | 648 | // int ramble=-24; |
663 | //first remove list | 649 | //first remove list |
664 | if(list.grep(dir,true).isEmpty()) { | 650 | if(list.grep(dir,true).isEmpty()) { |
665 | QMessageBox::message(tr( "AdvancedFm" ), | 651 | QMessageBox::message(tr( "AdvancedFm" ), |
666 | tr("<p>Cannot remove current directory from bookmarks. It is not bookmarked!</p>")); | 652 | tr("<p>Cannot remove current directory from bookmarks. It is not bookmarked!</p>")); |
667 | } else { | 653 | } else { |
668 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 654 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
669 | if((*it) != dir) { | 655 | if((*it) != dir) { |
670 | //current item is not our current dir, so add it to temp list | 656 | //current item is not our current dir, so add it to temp list |
671 | list2 <<(*it); | 657 | list2 <<(*it); |
672 | } else { | 658 | } else { |
673 | // customDirMenu->removeItem( ramble); | 659 | // customDirMenu->removeItem( ramble); |
674 | menuButton->remove( ramble); | 660 | menuButton->remove( ramble); |
675 | 661 | ||
676 | } | 662 | } |
677 | ramble++; | 663 | ramble++; |
678 | // ramble--; | 664 | // ramble--; |
679 | } | 665 | } |
680 | 666 | ||
681 | cfg.writeEntry("CustomDir", list2, ','); | 667 | cfg.writeEntry("CustomDir", list2, ','); |
682 | cfg.write(); | 668 | cfg.write(); |
683 | } | 669 | } |
684 | // customDirsToMenu(); | 670 | // customDirsToMenu(); |
685 | 671 | ||
686 | } | 672 | } |
687 | 673 | ||
688 | void AdvancedFm::gotoCustomDir(const QString &dir) { | 674 | void AdvancedFm::gotoCustomDir(const QString &dir) { |
689 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; | 675 | // odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; |
690 | // QString curDir = dir; | 676 | // QString curDir = dir; |
691 | // QDir *thisDir = CurrentDir(); | 677 | // QDir *thisDir = CurrentDir(); |
692 | // if( curDir.isEmpty()) { | 678 | // if( curDir.isEmpty()) { |
693 | // } | 679 | // } |
694 | if( dir == s_addBookmark) { | 680 | if( dir == s_addBookmark) { |
695 | addCustomDir(); | 681 | addCustomDir(); |
696 | } | 682 | } |
697 | if( dir == s_removeBookmark) { | 683 | if( dir == s_removeBookmark) { |
698 | removeCustomDir( ); | 684 | removeCustomDir( ); |
699 | } else { | 685 | } else { |
700 | changeTo( dir); | 686 | changeTo( dir); |
701 | // if(QDir( curDir).exists() ) | 687 | // if(QDir( curDir).exists() ) |
702 | // { | 688 | // { |
703 | // thisDir->setPath( curDir ); | 689 | // thisDir->setPath( curDir ); |
704 | // chdir( curDir.latin1() ); | 690 | // chdir( curDir.latin1() ); |
705 | // thisDir->cd( curDir, TRUE); | 691 | // thisDir->cd( curDir, TRUE); |
706 | // populateView(); | 692 | // populateView(); |
707 | // } | 693 | // } |
708 | } | 694 | } |
709 | } | 695 | } |
710 | 696 | ||
711 | QDir *AdvancedFm::CurrentDir() { | 697 | QDir *AdvancedFm::CurrentDir() { |
712 | if ( whichTab == 1) { | 698 | if ( whichTab == 1) { |
713 | // qDebug("CurrentTab is Local"); | 699 | // qDebug("CurrentTab is Local"); |
714 | return ¤tDir; | 700 | return ¤tDir; |
715 | } else { | 701 | } else { |
716 | // qDebug("CurrentTab is Remote"); | 702 | // qDebug("CurrentTab is Remote"); |
717 | return ¤tRemoteDir; | 703 | return ¤tRemoteDir; |
718 | } | 704 | } |
719 | } | 705 | } |
720 | 706 | ||
721 | QDir *AdvancedFm::OtherDir() { | 707 | QDir *AdvancedFm::OtherDir() { |
722 | // if ( TabWidget->currentWidget() == tab) { | 708 | // if ( TabWidget->currentWidget() == tab) { |
723 | if ( whichTab == 1) { | 709 | if ( whichTab == 1) { |
724 | return ¤tRemoteDir; | 710 | return ¤tRemoteDir; |
725 | } else { | 711 | } else { |
726 | return ¤tDir; | 712 | return ¤tDir; |
727 | } | 713 | } |
728 | } | 714 | } |
729 | 715 | ||
730 | QListView * AdvancedFm::CurrentView() { | 716 | QListView * AdvancedFm::CurrentView() { |
731 | // if ( TabWidget->currentWidget() == tab) { | 717 | // if ( TabWidget->currentWidget() == tab) { |
732 | if ( whichTab == 1) { | 718 | if ( whichTab == 1) { |
733 | // qDebug("CurrentView: local"); | 719 | // qDebug("CurrentView: local"); |
734 | return Local_View; | 720 | return Local_View; |
735 | } else { | 721 | } else { |
736 | // owarn << "CurrentView Tab 2" << oendl; | 722 | // owarn << "CurrentView Tab 2" << oendl; |
737 | // qDebug("CurrentView: remote"); | 723 | // qDebug("CurrentView: remote"); |
738 | return Remote_View; | 724 | return Remote_View; |
739 | } | 725 | } |
740 | } | 726 | } |
741 | 727 | ||
742 | QListView * AdvancedFm::OtherView() { | 728 | QListView * AdvancedFm::OtherView() { |
743 | if ( whichTab == 1) | 729 | if ( whichTab == 1) |
744 | return Remote_View; | 730 | return Remote_View; |
745 | else | 731 | else |
746 | return Local_View; | 732 | return Local_View; |
747 | } | 733 | } |
748 | 734 | ||
749 | void AdvancedFm::setOtherTabCurrent() { | 735 | void AdvancedFm::setOtherTabCurrent() { |
750 | // qDebug("setOtherTabCurrent() %d",whichTab); | 736 | // qDebug("setOtherTabCurrent() %d",whichTab); |
751 | if ( whichTab == 1) { | 737 | if ( whichTab == 1) { |
752 | TabWidget->setCurrentWidget(1); | 738 | TabWidget->setCurrentWidget(1); |
753 | } else { | 739 | } else { |
754 | TabWidget->setCurrentWidget(0); | 740 | TabWidget->setCurrentWidget(0); |
755 | } | 741 | } |
756 | // OtherView()->setFocus(); | 742 | // OtherView()->setFocus(); |
757 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 743 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
758 | } | 744 | } |
759 | 745 | ||
760 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 746 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
761 | // odebug << "qcop message "+msg << oendl; | 747 | // odebug << "qcop message "+msg << oendl; |
762 | QDataStream stream ( data, IO_ReadOnly ); | 748 | QDataStream stream ( data, IO_ReadOnly ); |
763 | if ( msg == "openDirectory(QString)" ) { | 749 | if ( msg == "openDirectory(QString)" ) { |
764 | // odebug << "received" << oendl; | 750 | // odebug << "received" << oendl; |
765 | QString file; | 751 | QString file; |
766 | stream >> file; | 752 | stream >> file; |
767 | changeTo( (const QString &) file); | 753 | changeTo( (const QString &) file); |
768 | } | 754 | } |
769 | } | 755 | } |
770 | 756 | ||
771 | void AdvancedFm::setDocument(const QString &file) { | 757 | void AdvancedFm::setDocument(const QString &file) { |
772 | changeTo( file); | 758 | changeTo( file); |
773 | |||
774 | } | 759 | } |
775 | 760 | ||
776 | 761 | ||
777 | void AdvancedFm::findFile(const QString &fileName) { | ||
778 | QFileInfo fi(fileName); | ||
779 | QListView *thisView = CurrentView(); | ||
780 | QListViewItemIterator it( thisView ); | ||
781 | for ( ; it.current(); ++it ) { | ||
782 | if(it.current()->text(0) == fi.fileName()) { | ||
783 | it.current()->setSelected(true); | ||
784 | thisView->ensureItemVisible(it.current()); | ||
785 | } | ||
786 | } | ||
787 | } | ||
788 | |||
789 | void AdvancedFm::slotSwitchMenu(int item) { | 762 | void AdvancedFm::slotSwitchMenu(int item) { |
790 | Q_UNUSED(item); | 763 | Q_UNUSED(item); |
791 | // qDebug( "Switch %d",item); | 764 | // qDebug( "Switch %d",item); |
792 | // viewMenu->setItemChecked(item, true); | 765 | // viewMenu->setItemChecked(item, true); |
793 | } | 766 | } |
794 | 767 | ||
795 | void AdvancedFm::navigateToSelected() { | 768 | void AdvancedFm::navigateToSelected() { |
796 | if( !CurrentView()->currentItem()) return; | 769 | if( !CurrentView()->currentItem()) return; |
797 | doDirChange(); | 770 | doDirChange(); |
798 | } | 771 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 6f7eb96..42f3bc6 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,192 +1,191 @@ | |||
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: | 60 | protected: |
61 | 61 | ||
62 | Opie::Ui::OSplitter *TabWidget; | 62 | Opie::Ui::OSplitter *TabWidget; |
63 | QCopChannel * channel; | 63 | QCopChannel * channel; |
64 | QPixmap unknownXpm; | 64 | QPixmap unknownXpm; |
65 | int whichTab; | 65 | int whichTab; |
66 | // QTabWidget *TabWidget; | 66 | // QTabWidget *TabWidget; |
67 | QWidget *tab, *tab_2, *tab_3; | 67 | QWidget *tab, *tab_2, *tab_3; |
68 | QListView *Local_View, *Remote_View; | 68 | QListView *Local_View, *Remote_View; |
69 | 69 | ||
70 | QLineEdit *currentPathEdit; | 70 | QLineEdit *currentPathEdit; |
71 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 71 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
72 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 72 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
73 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 73 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
74 | QDir currentDir, currentRemoteDir; | 74 | QDir currentDir, currentRemoteDir; |
75 | QComboBox *currentPathCombo; | 75 | QComboBox *currentPathCombo; |
76 | QString filterStr, s_addBookmark, s_removeBookmark; | 76 | QString filterStr, s_addBookmark, s_removeBookmark; |
77 | QListViewItem * item; | 77 | QListViewItem * item; |
78 | bool b; | 78 | bool b; |
79 | QStringList fileSystemTypeList, fsList; | 79 | QStringList fileSystemTypeList, fsList; |
80 | int currentServerConfig; | 80 | int currentServerConfig; |
81 | bool zaurusDevice; | 81 | bool zaurusDevice; |
82 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 82 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
83 | QStringList remoteDirPathStringList, localDirPathStringList; | 83 | QStringList remoteDirPathStringList, localDirPathStringList; |
84 | QLineEdit *renameBox; | 84 | QLineEdit *renameBox; |
85 | 85 | ||
86 | void init(); | 86 | void init(); |
87 | void initConnections(); | 87 | void initConnections(); |
88 | void keyReleaseEvent( QKeyEvent *); | 88 | void keyReleaseEvent( QKeyEvent *); |
89 | void keyPressEvent( QKeyEvent *); | 89 | void keyPressEvent( QKeyEvent *); |
90 | QString getFileSystemType(const QString &); | 90 | QString getFileSystemType(const QString &); |
91 | QString getDiskSpace(const QString &); | 91 | QString getDiskSpace(const QString &); |
92 | void parsetab(const QString &fileName); | 92 | void parsetab(const QString &fileName); |
93 | QString checkDiskSpace(const QString &); | 93 | QString checkDiskSpace(const QString &); |
94 | QString dealWithSymName(const QString &); | 94 | QString dealWithSymName(const QString &); |
95 | QDir *CurrentDir(); | 95 | QDir *CurrentDir(); |
96 | QDir *OtherDir(); | 96 | QDir *OtherDir(); |
97 | QListView *CurrentView(); | 97 | QListView *CurrentView(); |
98 | QListView *OtherView(); | 98 | QListView *OtherView(); |
99 | void setOtherTabCurrent(); | 99 | void setOtherTabCurrent(); |
100 | void changeTo(const QString dir); | 100 | void changeTo(const QString dir); |
101 | 101 | ||
102 | //protected signals: | 102 | //protected signals: |
103 | // void newPath(QString); | 103 | // void newPath(QString); |
104 | 104 | ||
105 | protected slots: | 105 | protected slots: |
106 | void slotSwitchMenu(int); | 106 | void slotSwitchMenu(int); |
107 | void selectAll(); | 107 | void selectAll(); |
108 | void addToDocs(); | 108 | void addToDocs(); |
109 | void doDirChange(); | 109 | void doDirChange(); |
110 | void mkDir(); | 110 | void mkDir(); |
111 | void del(); | 111 | void del(); |
112 | void rn(); | 112 | void rn(); |
113 | void populateView(); | 113 | void populateView(); |
114 | void rePopulate(); | 114 | void rePopulate(); |
115 | void showHidden(); | 115 | void showHidden(); |
116 | void showMenuHidden(); | 116 | void showMenuHidden(); |
117 | void ListClicked(QListViewItem *); | 117 | void ListClicked(QListViewItem *); |
118 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 118 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
119 | void makeDir(); | 119 | void makeDir(); |
120 | void doDelete(); | 120 | void doDelete(); |
121 | void tabChanged(QWidget*); | 121 | void tabChanged(QWidget*); |
122 | void cleanUp(); | 122 | void cleanUp(); |
123 | void renameIt(); | 123 | void renameIt(); |
124 | void runThis(); | 124 | void runThis(); |
125 | void runText(); | 125 | void runText(); |
126 | void filePerms(); | 126 | void filePerms(); |
127 | void doProperties(); | 127 | void doProperties(); |
128 | void runCommand(); | 128 | void runCommand(); |
129 | void runCommandStd(); | 129 | void runCommandStd(); |
130 | QStringList getPath(); | 130 | QStringList getPath(); |
131 | void mkSym(); | 131 | void mkSym(); |
132 | void switchToLocalTab(); | 132 | void switchToLocalTab(); |
133 | void switchToRemoteTab(); | 133 | void switchToRemoteTab(); |
134 | void refreshCurrentTab(); | 134 | void refreshCurrentTab(); |
135 | 135 | ||
136 | void openSearch(); | 136 | void openSearch(); |
137 | void dirMenuSelected(int); | 137 | void dirMenuSelected(int); |
138 | void showFileMenu(); | 138 | void showFileMenu(); |
139 | void homeButtonPushed(); | 139 | void homeButtonPushed(); |
140 | void docButtonPushed(); | 140 | void docButtonPushed(); |
141 | void SDButtonPushed(); | 141 | void SDButtonPushed(); |
142 | void CFButtonPushed(); | 142 | void CFButtonPushed(); |
143 | void QPEButtonPushed(); | 143 | void QPEButtonPushed(); |
144 | void upDir(); | 144 | void upDir(); |
145 | void currentPathComboChanged(); | 145 | void currentPathComboChanged(); |
146 | 146 | ||
147 | void copy(); | 147 | void copy(); |
148 | void copyTimer(); | 148 | void copyTimer(); |
149 | void copyAs(); | 149 | void copyAs(); |
150 | void copyAsTimer(); | 150 | void copyAsTimer(); |
151 | void copySameDir(); | 151 | void copySameDir(); |
152 | void copySameDirTimer(); | 152 | void copySameDirTimer(); |
153 | void move(); | 153 | void move(); |
154 | void moveTimer(); | 154 | void moveTimer(); |
155 | 155 | ||
156 | void fillCombo(const QString &); | 156 | void fillCombo(const QString &); |
157 | bool copyFile( const QString & , const QString & ); | 157 | bool copyFile( const QString & , const QString & ); |
158 | void fileStatus(); | 158 | void fileStatus(); |
159 | void doAbout(); | 159 | void doAbout(); |
160 | void doBeam(); | 160 | void doBeam(); |
161 | void fileBeamFinished( Ir *); | 161 | void fileBeamFinished( Ir *); |
162 | bool copyDirectory( const QString & , const QString & ); | 162 | bool copyDirectory( const QString & , const QString & ); |
163 | // void navigateToSelected(); | 163 | // void navigateToSelected(); |
164 | bool moveDirectory( const QString & , const QString & ); | 164 | bool moveDirectory( const QString & , const QString & ); |
165 | 165 | ||
166 | // void slotSwitchtoLocal(int); | 166 | // void slotSwitchtoLocal(int); |
167 | 167 | ||
168 | private: | 168 | private: |
169 | MenuButton *menuButton; | 169 | MenuButton *menuButton; |
170 | QString oldName, localViewDir, remoteViewDir; | 170 | QString oldName, localViewDir, remoteViewDir; |
171 | void startProcess(const QString &); | 171 | void startProcess(const QString &); |
172 | bool eventFilter( QObject * , QEvent * ); | 172 | bool eventFilter( QObject * , QEvent * ); |
173 | void cancelRename(); | 173 | void cancelRename(); |
174 | void doRename(QListView *); | 174 | void doRename(QListView *); |
175 | void okRename(); | 175 | void okRename(); |
176 | void customDirsToMenu(); | 176 | void customDirsToMenu(); |
177 | void addCustomDir(); | 177 | void addCustomDir(); |
178 | void removeCustomDir(); | 178 | void removeCustomDir(); |
179 | void navigateToSelected(); | 179 | void navigateToSelected(); |
180 | void findFile(const QString &); | ||
181 | 180 | ||
182 | private slots: | 181 | private slots: |
183 | void processEnded(Opie::Core::OProcess *); | 182 | void processEnded(Opie::Core::OProcess *); |
184 | void oprocessStderr(Opie::Core::OProcess *, char *, int); | 183 | void oprocessStderr(Opie::Core::OProcess *, char *, int); |
185 | void gotoCustomDir(const QString &); | 184 | void gotoCustomDir(const QString &); |
186 | void qcopReceive(const QCString&, const QByteArray&); | 185 | void qcopReceive(const QCString&, const QByteArray&); |
187 | void setDocument(const QString &); | 186 | void setDocument(const QString &); |
188 | // void doMenu(int | 187 | // void doMenu(int |
189 | 188 | ||
190 | }; | 189 | }; |
191 | 190 | ||
192 | #endif // ADVANCEDFM_H | 191 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 1047c5a..9be0ceb 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,252 +1,250 @@ | |||
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 | |||
60 | |||
61 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 59 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
62 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 60 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
63 | qpeDirButton->setAutoRaise( true ); | 61 | qpeDirButton->setAutoRaise( true ); |
64 | menuBar->insertItem( qpeDirButton ); | 62 | menuBar->insertItem( qpeDirButton ); |
65 | 63 | ||
66 | cfButton = new QToolButton( 0, "CFButton"); | 64 | cfButton = new QToolButton( 0, "CFButton"); |
67 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 65 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
68 | cfButton->setAutoRaise( true ); | 66 | cfButton->setAutoRaise( true ); |
69 | menuBar->insertItem( cfButton ); | 67 | menuBar->insertItem( cfButton ); |
70 | 68 | ||
71 | sdButton = new QToolButton( 0, "SDButton"); | 69 | sdButton = new QToolButton( 0, "SDButton"); |
72 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 70 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
73 | sdButton->setAutoRaise( true ); | 71 | sdButton->setAutoRaise( true ); |
74 | menuBar->insertItem( sdButton ); | 72 | menuBar->insertItem( sdButton ); |
75 | 73 | ||
76 | docButton = new QToolButton( 0,"docsButton"); | 74 | docButton = new QToolButton( 0,"docsButton"); |
77 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 75 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
78 | docButton->setAutoRaise( true ); | 76 | docButton->setAutoRaise( true ); |
79 | menuBar->insertItem( docButton ); | 77 | menuBar->insertItem( docButton ); |
80 | 78 | ||
81 | homeButton = new QToolButton( 0, "homeButton"); | 79 | homeButton = new QToolButton( 0, "homeButton"); |
82 | homeButton->setPixmap(Resource::loadPixmap("home")); | 80 | homeButton->setPixmap(Resource::loadPixmap("home")); |
83 | homeButton->setAutoRaise( true ); | 81 | homeButton->setAutoRaise( true ); |
84 | menuBar->insertItem( homeButton ); | 82 | menuBar->insertItem( homeButton ); |
85 | 83 | ||
86 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 84 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
87 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 85 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
88 | fileMenu->insertSeparator(); | 86 | fileMenu->insertSeparator(); |
89 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 87 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
90 | fileMenu->insertSeparator(); | 88 | fileMenu->insertSeparator(); |
91 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 89 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
92 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 90 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
93 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 91 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
94 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 92 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
95 | fileMenu->insertSeparator(); | 93 | fileMenu->insertSeparator(); |
96 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 94 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
97 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 95 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
98 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 96 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
99 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 97 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
100 | fileMenu->setCheckable(TRUE); | 98 | fileMenu->setCheckable(TRUE); |
101 | 99 | ||
102 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 100 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
103 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 101 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
104 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); | 102 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); |
105 | // viewMenu->insertSeparator(); | 103 | // viewMenu->insertSeparator(); |
106 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 104 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
107 | viewMenu->setCheckable(true); | 105 | viewMenu->setCheckable(true); |
108 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 106 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
109 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 107 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
110 | 108 | ||
111 | s_addBookmark = tr("Bookmark Directory"); | 109 | s_addBookmark = tr("Bookmark Directory"); |
112 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 110 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
113 | 111 | ||
114 | // menuButton->insertItem(""); | 112 | // menuButton->insertItem(""); |
115 | 113 | ||
116 | // customDirMenu->insertItem(tr("Add This Directory")); | 114 | // customDirMenu->insertItem(tr("Add This Directory")); |
117 | // customDirMenu->insertItem(tr("Remove This Directory")); | 115 | // customDirMenu->insertItem(tr("Remove This Directory")); |
118 | // customDirMenu->insertSeparator(); | 116 | // customDirMenu->insertSeparator(); |
119 | 117 | ||
120 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 118 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
121 | CBHB->setMargin( 0 ); | 119 | CBHB->setMargin( 0 ); |
122 | CBHB->setSpacing( 1 ); | 120 | CBHB->setSpacing( 1 ); |
123 | 121 | ||
124 | menuButton = new MenuButton( this ); | 122 | menuButton = new MenuButton( this ); |
125 | 123 | ||
126 | menuButton->setUseLabel(false); | 124 | menuButton->setUseLabel(false); |
127 | menuButton->setMaximumWidth( 20 ); | 125 | menuButton->setMaximumWidth( 20 ); |
128 | menuButton->insertItem( s_addBookmark); | 126 | menuButton->insertItem( s_addBookmark); |
129 | menuButton->insertItem( s_removeBookmark); | 127 | menuButton->insertItem( s_removeBookmark); |
130 | menuButton->insertSeparator(); | 128 | menuButton->insertSeparator(); |
131 | // menuButton->setFocusPolicy(NoFocus); | 129 | // menuButton->setFocusPolicy(NoFocus); |
132 | CBHB->addWidget( menuButton ); | 130 | CBHB->addWidget( menuButton ); |
133 | 131 | ||
134 | customDirsToMenu(); | 132 | customDirsToMenu(); |
135 | 133 | ||
136 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 134 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
137 | currentPathCombo->setEditable(TRUE); | 135 | currentPathCombo->setEditable(TRUE); |
138 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 136 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
139 | // currentPathCombo->setFocusPolicy(NoFocus); | 137 | // currentPathCombo->setFocusPolicy(NoFocus); |
140 | CBHB->addWidget( currentPathCombo ); | 138 | CBHB->addWidget( currentPathCombo ); |
141 | 139 | ||
142 | layout->addLayout( CBHB ); | 140 | layout->addLayout( CBHB ); |
143 | 141 | ||
144 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 142 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
145 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 143 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
146 | layout->addWidget( TabWidget, 4 ); | 144 | layout->addWidget( TabWidget, 4 ); |
147 | 145 | ||
148 | tab = new QWidget( TabWidget, "tab" ); | 146 | tab = new QWidget( TabWidget, "tab" ); |
149 | tabLayout = new QGridLayout( tab ); | 147 | tabLayout = new QGridLayout( tab ); |
150 | tabLayout->setSpacing( 2); | 148 | tabLayout->setSpacing( 2); |
151 | tabLayout->setMargin( 2); | 149 | tabLayout->setMargin( 2); |
152 | 150 | ||
153 | Local_View = new QListView( tab, "Local_View" ); | 151 | Local_View = new QListView( tab, "Local_View" ); |
154 | Local_View->addColumn( tr("File"),130); | 152 | Local_View->addColumn( tr("File"),130); |
155 | Local_View->addColumn( tr("Size"),-1); | 153 | Local_View->addColumn( tr("Size"),-1); |
156 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 154 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
157 | Local_View->addColumn( tr("Date"),-1); | 155 | Local_View->addColumn( tr("Date"),-1); |
158 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 156 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
159 | Local_View->setAllColumnsShowFocus(TRUE); | 157 | Local_View->setAllColumnsShowFocus(TRUE); |
160 | Local_View->setMultiSelection( TRUE ); | 158 | Local_View->setMultiSelection( TRUE ); |
161 | Local_View->setSelectionMode(QListView::Extended); | 159 | Local_View->setSelectionMode(QListView::Extended); |
162 | Local_View->setFocusPolicy(StrongFocus); | 160 | Local_View->setFocusPolicy(StrongFocus); |
163 | Local_View->installEventFilter( this ); | 161 | Local_View->installEventFilter( this ); |
164 | 162 | ||
165 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); | 163 | QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold); |
166 | 164 | ||
167 | tabLayout->addWidget( Local_View, 0, 0 ); | 165 | tabLayout->addWidget( Local_View, 0, 0 ); |
168 | 166 | ||
169 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 167 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
170 | // TabWidget->insertTab( tab, tr("1")); | 168 | // TabWidget->insertTab( tab, tr("1")); |
171 | 169 | ||
172 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 170 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
173 | tabLayout_2 = new QGridLayout( tab_2 ); | 171 | tabLayout_2 = new QGridLayout( tab_2 ); |
174 | tabLayout_2->setSpacing( 2); | 172 | tabLayout_2->setSpacing( 2); |
175 | tabLayout_2->setMargin( 2); | 173 | tabLayout_2->setMargin( 2); |
176 | 174 | ||
177 | Remote_View = new QListView( tab_2, "Remote_View" ); | 175 | Remote_View = new QListView( tab_2, "Remote_View" ); |
178 | Remote_View->addColumn( tr("File"),130); | 176 | Remote_View->addColumn( tr("File"),130); |
179 | Remote_View->addColumn( tr("Size"),-1); | 177 | Remote_View->addColumn( tr("Size"),-1); |
180 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 178 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
181 | Remote_View->addColumn( tr("Date"),-1); | 179 | Remote_View->addColumn( tr("Date"),-1); |
182 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 180 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
183 | Remote_View->setAllColumnsShowFocus(TRUE); | 181 | Remote_View->setAllColumnsShowFocus(TRUE); |
184 | Remote_View->setMultiSelection( TRUE ); | 182 | Remote_View->setMultiSelection( TRUE ); |
185 | Remote_View->setSelectionMode(QListView::Extended); | 183 | Remote_View->setSelectionMode(QListView::Extended); |
186 | Remote_View->setFocusPolicy(StrongFocus); | 184 | Remote_View->setFocusPolicy(StrongFocus); |
187 | Remote_View->installEventFilter( this ); | 185 | Remote_View->installEventFilter( this ); |
188 | 186 | ||
189 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); | 187 | QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold); |
190 | 188 | ||
191 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 189 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
192 | 190 | ||
193 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 191 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
194 | TabWidget->setSizeChange( 370 ); | 192 | TabWidget->setSizeChange( 370 ); |
195 | // TabWidget->insertTab( tab_2, tr( "2")); | 193 | // TabWidget->insertTab( tab_2, tr( "2")); |
196 | 194 | ||
197 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 195 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
198 | tabLayout_3 = new QGridLayout( tab_3 ); | 196 | tabLayout_3 = new QGridLayout( tab_3 ); |
199 | tabLayout_3->setSpacing( 2); | 197 | tabLayout_3->setSpacing( 2); |
200 | tabLayout_3->setMargin( 2); | 198 | tabLayout_3->setMargin( 2); |
201 | 199 | ||
202 | 200 | ||
203 | // OFileDialog fileDialog; | 201 | // OFileDialog fileDialog; |
204 | // fileDialog; | 202 | // fileDialog; |
205 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 203 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
206 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 204 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
207 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 205 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
208 | 206 | ||
209 | QListView *fileTree; | 207 | QListView *fileTree; |
210 | fileTree = new QListView( tab_3, "tree" ); | 208 | fileTree = new QListView( tab_3, "tree" ); |
211 | 209 | ||
212 | 210 | ||
213 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 211 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
214 | 212 | ||
215 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 213 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
216 | */ | 214 | */ |
217 | 215 | ||
218 | /////////////// | 216 | /////////////// |
219 | 217 | ||
220 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 218 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
221 | zaurusDevice=TRUE; | 219 | zaurusDevice=TRUE; |
222 | else | 220 | else |
223 | zaurusDevice=FALSE; | 221 | zaurusDevice=FALSE; |
224 | 222 | ||
225 | 223 | ||
226 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 224 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
227 | odebug << "not have sd" << oendl; | 225 | odebug << "not have sd" << oendl; |
228 | sdButton->hide(); | 226 | sdButton->hide(); |
229 | } | 227 | } |
230 | if( !StorageInfo::hasCf() ) { | 228 | if( !StorageInfo::hasCf() ) { |
231 | odebug << "not have cf" << oendl; | 229 | odebug << "not have cf" << oendl; |
232 | cfButton->hide(); | 230 | cfButton->hide(); |
233 | } | 231 | } |
234 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 232 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
235 | currentDir.setPath( QDir::currentDirPath()); | 233 | currentDir.setPath( QDir::currentDirPath()); |
236 | 234 | ||
237 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 235 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
238 | currentRemoteDir.setPath( QDir::currentDirPath()); | 236 | currentRemoteDir.setPath( QDir::currentDirPath()); |
239 | 237 | ||
240 | // b = TRUE; | 238 | // b = TRUE; |
241 | 239 | ||
242 | filterStr="*"; | 240 | filterStr="*"; |
243 | showMenuHidden(); | 241 | showMenuHidden(); |
244 | TabWidget->setCurrentWidget(0); | 242 | TabWidget->setCurrentWidget(0); |
245 | 243 | ||
246 | } | 244 | } |
247 | 245 | ||
248 | void AdvancedFm::initConnections() | 246 | void AdvancedFm::initConnections() |
249 | { | 247 | { |
250 | 248 | ||
251 | connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(cleanUp())); | 249 | connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(cleanUp())); |
252 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 250 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |