author | zecke <zecke> | 2003-09-01 16:33:33 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-09-01 16:33:33 (UTC) |
commit | aa1be5c49b77368999f068222f5f4e1f0d1ace0d (patch) (unidiff) | |
tree | 63f4283d3e68e6b4c1d0a81dd306276813c1a0c8 | |
parent | 4e7703b3055562d93dc2d993f47888a3538429d2 (diff) | |
download | opie-aa1be5c49b77368999f068222f5f4e1f0d1ace0d.zip opie-aa1be5c49b77368999f068222f5f4e1f0d1ace0d.tar.gz opie-aa1be5c49b77368999f068222f5f4e1f0d1ace0d.tar.bz2 |
port to OSplitter but QComboBox is a sucker
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 11 |
3 files changed, 15 insertions, 14 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 77dca49..91318f1 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,477 +1,477 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | 15 | ||
16 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
17 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
18 | 18 | ||
19 | #include <opie/otabwidget.h> | 19 | #include <opie/osplitter.h> |
20 | 20 | ||
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
30 | 30 | ||
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qimage.h> | 39 | #include <qimage.h> |
40 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | 42 | ||
43 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
44 | #include <time.h> | 44 | #include <time.h> |
45 | #include <dirent.h> | 45 | #include <dirent.h> |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <sys/vfs.h> | 47 | #include <sys/vfs.h> |
48 | #include <mntent.h> | 48 | #include <mntent.h> |
49 | 49 | ||
50 | AdvancedFm::AdvancedFm( ) | 50 | AdvancedFm::AdvancedFm( ) |
51 | : QMainWindow( ) { | 51 | : QMainWindow( ) { |
52 | init(); | 52 | init(); |
53 | renameBox = 0; | 53 | renameBox = 0; |
54 | 54 | ||
55 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 55 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
56 | 56 | ||
57 | initConnections(); | 57 | initConnections(); |
58 | whichTab=1; | 58 | whichTab=1; |
59 | rePopulate(); | 59 | rePopulate(); |
60 | currentPathCombo->setFocus(); | 60 | currentPathCombo->setFocus(); |
61 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 61 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
62 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 62 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
63 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 63 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); |
64 | } | 64 | } |
65 | 65 | ||
66 | AdvancedFm::~AdvancedFm() { | 66 | AdvancedFm::~AdvancedFm() { |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | void AdvancedFm::cleanUp() | 70 | void AdvancedFm::cleanUp() |
71 | { | 71 | { |
72 | QString sfile=QDir::homeDirPath(); | 72 | QString sfile=QDir::homeDirPath(); |
73 | if(sfile.right(1) != "/") | 73 | if(sfile.right(1) != "/") |
74 | sfile+="/._temp"; | 74 | sfile+="/._temp"; |
75 | else | 75 | else |
76 | sfile+="._temp"; | 76 | sfile+="._temp"; |
77 | QFile file( sfile); | 77 | QFile file( sfile); |
78 | if(file.exists()) | 78 | if(file.exists()) |
79 | file.remove(); | 79 | file.remove(); |
80 | } | 80 | } |
81 | 81 | ||
82 | void AdvancedFm::tabChanged(QWidget *w) | 82 | void AdvancedFm::tabChanged(QWidget *w) |
83 | { | 83 | { |
84 | if( w == tab) | 84 | if( w == tab) |
85 | whichTab = 1; | 85 | whichTab = 1; |
86 | else | 86 | else |
87 | whichTab = 2; | 87 | whichTab = 2; |
88 | 88 | ||
89 | // qDebug("tab changed %d", whichTab ); | 89 | // qDebug("tab changed %d", whichTab ); |
90 | 90 | ||
91 | QString path = CurrentDir()->canonicalPath(); | 91 | QString path = CurrentDir()->canonicalPath(); |
92 | currentPathCombo->lineEdit()->setText( path ); | 92 | currentPathCombo->lineEdit()->setText( path ); |
93 | 93 | ||
94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
96 | 96 | ||
97 | QString fs= getFileSystemType( (const QString &) path); | 97 | QString fs= getFileSystemType( (const QString &) path); |
98 | 98 | ||
99 | setCaption("AdvancedFm :: "+fs+" :: " | 99 | setCaption("AdvancedFm :: "+fs+" :: " |
100 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 100 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
101 | chdir( path.latin1()); | 101 | chdir( path.latin1()); |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | void AdvancedFm::populateView() | 105 | void AdvancedFm::populateView() |
106 | { | 106 | { |
107 | QPixmap pm; | 107 | QPixmap pm; |
108 | QListView *thisView = CurrentView(); | 108 | QListView *thisView = CurrentView(); |
109 | QDir *thisDir = CurrentDir(); | 109 | QDir *thisDir = CurrentDir(); |
110 | QString path = thisDir->canonicalPath(); | 110 | QString path = thisDir->canonicalPath(); |
111 | 111 | ||
112 | thisView->clear(); | 112 | thisView->clear(); |
113 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 113 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
114 | thisDir->setMatchAllDirs(TRUE); | 114 | thisDir->setMatchAllDirs(TRUE); |
115 | thisDir->setNameFilter(filterStr); | 115 | thisDir->setNameFilter(filterStr); |
116 | QString fileL, fileS, fileDate; | 116 | QString fileL, fileS, fileDate; |
117 | QString fs= getFileSystemType((const QString &) path); | 117 | QString fs= getFileSystemType((const QString &) path); |
118 | setCaption("AdvancedFm :: "+fs+" :: " | 118 | setCaption("AdvancedFm :: "+fs+" :: " |
119 | +checkDiskSpace((const QString &) path)+" kB free" ); | 119 | +checkDiskSpace((const QString &) path)+" kB free" ); |
120 | bool isDir=FALSE; | 120 | bool isDir=FALSE; |
121 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 121 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
122 | QFileInfoListIterator it(*list); | 122 | QFileInfoListIterator it(*list); |
123 | QFileInfo *fi; | 123 | QFileInfo *fi; |
124 | while ( (fi=it.current()) ) { | 124 | while ( (fi=it.current()) ) { |
125 | if (fi->isSymLink() ) { | 125 | if (fi->isSymLink() ) { |
126 | QString symLink=fi->readLink(); | 126 | QString symLink=fi->readLink(); |
127 | QFileInfo sym( symLink); | 127 | QFileInfo sym( symLink); |
128 | fileS.sprintf( "%10i", sym.size() ); | 128 | fileS.sprintf( "%10i", sym.size() ); |
129 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 129 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
130 | fileDate = sym.lastModified().toString(); | 130 | fileDate = sym.lastModified().toString(); |
131 | } else { | 131 | } else { |
132 | fileS.sprintf( "%10i", fi->size() ); | 132 | fileS.sprintf( "%10i", fi->size() ); |
133 | fileL = fi->fileName(); | 133 | fileL = fi->fileName(); |
134 | fileDate= fi->lastModified().toString(); | 134 | fileDate= fi->lastModified().toString(); |
135 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 135 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
136 | fileL+="/"; | 136 | fileL+="/"; |
137 | isDir=TRUE; | 137 | isDir=TRUE; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | QFileInfo fileInfo( path + "/" + fileL); | 140 | QFileInfo fileInfo( path + "/" + fileL); |
141 | 141 | ||
142 | if(fileL !="./" && fi->exists()) { | 142 | if(fileL !="./" && fi->exists()) { |
143 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 143 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
144 | 144 | ||
145 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 145 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
146 | 146 | ||
147 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 147 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
148 | pm = Resource::loadPixmap( "lockedfolder" ); | 148 | pm = Resource::loadPixmap( "lockedfolder" ); |
149 | else | 149 | else |
150 | pm= Resource::loadPixmap( "folder" ); | 150 | pm= Resource::loadPixmap( "folder" ); |
151 | } | 151 | } |
152 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 152 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
153 | pm = Resource::loadPixmap( "exec"); | 153 | pm = Resource::loadPixmap( "exec"); |
154 | } | 154 | } |
155 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 155 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
156 | | fileInfo.permission( QFileInfo::ExeGroup) | 156 | | fileInfo.permission( QFileInfo::ExeGroup) |
157 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 157 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
158 | pm = Resource::loadPixmap( "exec"); | 158 | pm = Resource::loadPixmap( "exec"); |
159 | } | 159 | } |
160 | else if( !fi->isReadable() ) { | 160 | else if( !fi->isReadable() ) { |
161 | pm = Resource::loadPixmap( "locked" ); | 161 | pm = Resource::loadPixmap( "locked" ); |
162 | } | 162 | } |
163 | else { //everything else goes by mimetype | 163 | else { //everything else goes by mimetype |
164 | MimeType mt(fi->filePath()); | 164 | MimeType mt(fi->filePath()); |
165 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 165 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
166 | if(pm.isNull()) { | 166 | if(pm.isNull()) { |
167 | pm = unknownXpm; | 167 | pm = unknownXpm; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 170 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
171 | // qDebug(" overlay link image"); | 171 | // qDebug(" overlay link image"); |
172 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 172 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
173 | // pm= Resource::loadPixmap( "folder" ); | 173 | // pm= Resource::loadPixmap( "folder" ); |
174 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 174 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
175 | // QPainter painter( &pm ); | 175 | // QPainter painter( &pm ); |
176 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 176 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
177 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 177 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
178 | } | 178 | } |
179 | item->setPixmap( 0,pm); | 179 | item->setPixmap( 0,pm); |
180 | 180 | ||
181 | } | 181 | } |
182 | isDir=FALSE; | 182 | isDir=FALSE; |
183 | ++it; | 183 | ++it; |
184 | } | 184 | } |
185 | 185 | ||
186 | if( path.find("dev",0,TRUE) != -1) { | 186 | if( path.find("dev",0,TRUE) != -1) { |
187 | struct stat buf; | 187 | struct stat buf; |
188 | dev_t devT; | 188 | dev_t devT; |
189 | DIR *dir; | 189 | DIR *dir; |
190 | struct dirent *mydirent; | 190 | struct dirent *mydirent; |
191 | 191 | ||
192 | if((dir = opendir( path.latin1())) != NULL) | 192 | if((dir = opendir( path.latin1())) != NULL) |
193 | while ((mydirent = readdir(dir)) != NULL) { | 193 | while ((mydirent = readdir(dir)) != NULL) { |
194 | lstat( mydirent->d_name, &buf); | 194 | lstat( mydirent->d_name, &buf); |
195 | // qDebug(mydirent->d_name); | 195 | // qDebug(mydirent->d_name); |
196 | fileL.sprintf("%s", mydirent->d_name); | 196 | fileL.sprintf("%s", mydirent->d_name); |
197 | devT = buf.st_dev; | 197 | devT = buf.st_dev; |
198 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 198 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
199 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 199 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
200 | if( fileL.find(".") == -1 ) { | 200 | if( fileL.find(".") == -1 ) { |
201 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 201 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
202 | pm = unknownXpm; | 202 | pm = unknownXpm; |
203 | item->setPixmap( 0,pm); | 203 | item->setPixmap( 0,pm); |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | closedir(dir); | 207 | closedir(dir); |
208 | } | 208 | } |
209 | 209 | ||
210 | thisView->setSorting( 3,FALSE); | 210 | thisView->setSorting( 3,FALSE); |
211 | fillCombo( (const QString &) path ); | 211 | fillCombo( (const QString &) path ); |
212 | } | 212 | } |
213 | 213 | ||
214 | void AdvancedFm::rePopulate() | 214 | void AdvancedFm::rePopulate() |
215 | { | 215 | { |
216 | int tmpTab = whichTab; | 216 | int tmpTab = whichTab; |
217 | qDebug("%d", tmpTab); | 217 | qDebug("%d", tmpTab); |
218 | 218 | ||
219 | for(int i =1; i < 3; i++) | 219 | for(int i =1; i < 3; i++) |
220 | { | 220 | { |
221 | TabWidget->setCurrentTab(i - 1); | 221 | TabWidget->setCurrentWidget(i - 1); |
222 | populateView(); | 222 | populateView(); |
223 | } | 223 | } |
224 | TabWidget->setCurrentTab( tmpTab - 1); | 224 | TabWidget->setCurrentWidget( tmpTab - 1); |
225 | } | 225 | } |
226 | 226 | ||
227 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 227 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) |
228 | { | 228 | { |
229 | if(selectedItem) | 229 | if(selectedItem) |
230 | { | 230 | { |
231 | QString strItem=selectedItem->text(0); | 231 | QString strItem=selectedItem->text(0); |
232 | QString strSize=selectedItem->text(1); | 232 | QString strSize=selectedItem->text(1); |
233 | strSize=strSize.stripWhiteSpace(); | 233 | strSize=strSize.stripWhiteSpace(); |
234 | bool isDirectory = false; | 234 | bool isDirectory = false; |
235 | QString strItem2; | 235 | QString strItem2; |
236 | 236 | ||
237 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 237 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
238 | { | 238 | { |
239 | strItem2 = dealWithSymName((const QString&)strItem); | 239 | strItem2 = dealWithSymName((const QString&)strItem); |
240 | if(QDir(strItem2).exists() ) | 240 | if(QDir(strItem2).exists() ) |
241 | strItem = strItem2; | 241 | strItem = strItem2; |
242 | } | 242 | } |
243 | 243 | ||
244 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 244 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
245 | { | 245 | { |
246 | 246 | ||
247 | if(QDir(strItem).exists()) | 247 | if(QDir(strItem).exists()) |
248 | isDirectory = true; | 248 | isDirectory = true; |
249 | } | 249 | } |
250 | 250 | ||
251 | if( isDirectory ) | 251 | if( isDirectory ) |
252 | { | 252 | { |
253 | CurrentDir()->cd( strItem, TRUE); | 253 | CurrentDir()->cd( strItem, TRUE); |
254 | populateView(); | 254 | populateView(); |
255 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 255 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
256 | } | 256 | } |
257 | chdir( strItem.latin1()); | 257 | chdir( strItem.latin1()); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 261 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
262 | switch (mouse) { | 262 | switch (mouse) { |
263 | case 1: | 263 | case 1: |
264 | { | 264 | { |
265 | if(renameBox != 0 ) | 265 | if(renameBox != 0 ) |
266 | { | 266 | { |
267 | cancelRename(); | 267 | cancelRename(); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | break; | 270 | break; |
271 | case 2: | 271 | case 2: |
272 | menuTimer.start( 500, TRUE ); | 272 | menuTimer.start( 500, TRUE ); |
273 | break; | 273 | break; |
274 | }; | 274 | }; |
275 | } | 275 | } |
276 | 276 | ||
277 | void AdvancedFm::switchToLocalTab() | 277 | void AdvancedFm::switchToLocalTab() |
278 | { | 278 | { |
279 | TabWidget->setCurrentTab(0); | 279 | TabWidget->setCurrentWidget(0); |
280 | Local_View->setFocus(); | 280 | Local_View->setFocus(); |
281 | } | 281 | } |
282 | 282 | ||
283 | void AdvancedFm::switchToRemoteTab() | 283 | void AdvancedFm::switchToRemoteTab() |
284 | { | 284 | { |
285 | TabWidget->setCurrentTab(1); | 285 | TabWidget->setCurrentWidget(1); |
286 | Remote_View->setFocus(); | 286 | Remote_View->setFocus(); |
287 | } | 287 | } |
288 | 288 | ||
289 | void AdvancedFm::readConfig() | 289 | void AdvancedFm::readConfig() |
290 | { | 290 | { |
291 | Config cfg("AdvancedFm"); | 291 | Config cfg("AdvancedFm"); |
292 | } | 292 | } |
293 | 293 | ||
294 | void AdvancedFm::writeConfig() | 294 | void AdvancedFm::writeConfig() |
295 | { | 295 | { |
296 | Config cfg("AdvancedFm"); | 296 | Config cfg("AdvancedFm"); |
297 | } | 297 | } |
298 | 298 | ||
299 | void AdvancedFm::currentPathComboChanged() | 299 | void AdvancedFm::currentPathComboChanged() |
300 | { | 300 | { |
301 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) | 301 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) |
302 | { | 302 | { |
303 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 303 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
304 | populateView(); | 304 | populateView(); |
305 | } | 305 | } |
306 | else | 306 | else |
307 | { | 307 | { |
308 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 308 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | void AdvancedFm::fillCombo(const QString ¤tPath) | 312 | void AdvancedFm::fillCombo(const QString ¤tPath) |
313 | { | 313 | { |
314 | // qDebug("%d",TabWidget->currentTab()); | 314 | // qDebug("%d",TabWidget->currentTab()); |
315 | if ( whichTab == 1) | 315 | if ( whichTab == 1) |
316 | { | 316 | { |
317 | currentPathCombo->lineEdit()->setText( currentPath); | 317 | currentPathCombo->lineEdit()->setText( currentPath); |
318 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 318 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
319 | { | 319 | { |
320 | currentPathCombo->clear(); | 320 | currentPathCombo->clear(); |
321 | localDirPathStringList.prepend( currentPath ); | 321 | localDirPathStringList.prepend( currentPath ); |
322 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 322 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | else | 325 | else |
326 | { | 326 | { |
327 | currentPathCombo->lineEdit()->setText( currentPath); | 327 | currentPathCombo->lineEdit()->setText( currentPath); |
328 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 328 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) |
329 | { | 329 | { |
330 | currentPathCombo->clear(); | 330 | currentPathCombo->clear(); |
331 | remoteDirPathStringList.prepend( currentPath ); | 331 | remoteDirPathStringList.prepend( currentPath ); |
332 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 332 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) | 337 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) |
338 | { | 338 | { |
339 | chdir( currentPath.latin1() ); | 339 | chdir( currentPath.latin1() ); |
340 | CurrentDir()->cd( currentPath, TRUE); | 340 | CurrentDir()->cd( currentPath, TRUE); |
341 | populateView(); | 341 | populateView(); |
342 | update(); | 342 | update(); |
343 | } | 343 | } |
344 | 344 | ||
345 | QStringList AdvancedFm::getPath() | 345 | QStringList AdvancedFm::getPath() |
346 | { | 346 | { |
347 | QStringList strList; | 347 | QStringList strList; |
348 | QListView *thisView=CurrentView(); | 348 | QListView *thisView=CurrentView(); |
349 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 349 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
350 | QListViewItemIterator it( thisView ); | 350 | QListViewItemIterator it( thisView ); |
351 | for ( ; it.current(); ++it ) | 351 | for ( ; it.current(); ++it ) |
352 | { | 352 | { |
353 | if ( it.current()->isSelected() ) | 353 | if ( it.current()->isSelected() ) |
354 | { | 354 | { |
355 | strList << it.current()->text(0); | 355 | strList << it.current()->text(0); |
356 | // qDebug(it.current()->text(0)); | 356 | // qDebug(it.current()->text(0)); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | return strList; | 359 | return strList; |
360 | } | 360 | } |
361 | 361 | ||
362 | void AdvancedFm::homeButtonPushed() | 362 | void AdvancedFm::homeButtonPushed() |
363 | { | 363 | { |
364 | QString current = QDir::homeDirPath(); | 364 | QString current = QDir::homeDirPath(); |
365 | chdir( current.latin1() ); | 365 | chdir( current.latin1() ); |
366 | CurrentDir()->cd( current, TRUE); | 366 | CurrentDir()->cd( current, TRUE); |
367 | populateView(); | 367 | populateView(); |
368 | update(); | 368 | update(); |
369 | } | 369 | } |
370 | 370 | ||
371 | void AdvancedFm::docButtonPushed() | 371 | void AdvancedFm::docButtonPushed() |
372 | { | 372 | { |
373 | QString current = QPEApplication::documentDir(); | 373 | QString current = QPEApplication::documentDir(); |
374 | chdir( current.latin1() ); | 374 | chdir( current.latin1() ); |
375 | CurrentDir()->cd( current, TRUE); | 375 | CurrentDir()->cd( current, TRUE); |
376 | populateView(); | 376 | populateView(); |
377 | update(); | 377 | update(); |
378 | } | 378 | } |
379 | 379 | ||
380 | void AdvancedFm::SDButtonPushed() | 380 | void AdvancedFm::SDButtonPushed() |
381 | { | 381 | { |
382 | QString current = "/mnt/card";// this can change so fix | 382 | QString current = "/mnt/card";// this can change so fix |
383 | chdir( current.latin1() ); | 383 | chdir( current.latin1() ); |
384 | CurrentDir()->cd( current, TRUE); | 384 | CurrentDir()->cd( current, TRUE); |
385 | populateView(); | 385 | populateView(); |
386 | update(); | 386 | update(); |
387 | } | 387 | } |
388 | 388 | ||
389 | void AdvancedFm::CFButtonPushed() | 389 | void AdvancedFm::CFButtonPushed() |
390 | { | 390 | { |
391 | QString current; | 391 | QString current; |
392 | if(zaurusDevice) | 392 | if(zaurusDevice) |
393 | current= "/mnt/cf"; //zaurus | 393 | current= "/mnt/cf"; //zaurus |
394 | else | 394 | else |
395 | current = "/mnt/hda"; //ipaq | 395 | current = "/mnt/hda"; //ipaq |
396 | chdir( current.latin1() ); | 396 | chdir( current.latin1() ); |
397 | CurrentDir()->cd( current, TRUE); | 397 | CurrentDir()->cd( current, TRUE); |
398 | populateView(); | 398 | populateView(); |
399 | update(); | 399 | update(); |
400 | } | 400 | } |
401 | 401 | ||
402 | 402 | ||
403 | void AdvancedFm::doAbout() | 403 | void AdvancedFm::doAbout() |
404 | { | 404 | { |
405 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 405 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
406 | "is copyright 2002-2003 by\n" | 406 | "is copyright 2002-2003 by\n" |
407 | "L.J.Potter<llornkcor@handhelds.org>\n" | 407 | "L.J.Potter<llornkcor@handhelds.org>\n" |
408 | "and is licensed by the GPL")); | 408 | "and is licensed by the GPL")); |
409 | } | 409 | } |
410 | 410 | ||
411 | void AdvancedFm::keyPressEvent( QKeyEvent *e) | 411 | void AdvancedFm::keyPressEvent( QKeyEvent *e) |
412 | { | 412 | { |
413 | // e->accept(); | 413 | // e->accept(); |
414 | if( CurrentView()->hasFocus() ) | 414 | if( CurrentView()->hasFocus() ) |
415 | { | 415 | { |
416 | switch ( e->key() ) { | 416 | switch ( e->key() ) { |
417 | case Key_Delete: | 417 | case Key_Delete: |
418 | del(); | 418 | del(); |
419 | break; | 419 | break; |
420 | case Key_A: | 420 | case Key_A: |
421 | copyAs(); | 421 | copyAs(); |
422 | break; | 422 | break; |
423 | case Key_C: | 423 | case Key_C: |
424 | copy(); | 424 | copy(); |
425 | break; | 425 | break; |
426 | case Key_E: | 426 | case Key_E: |
427 | runThis(); | 427 | runThis(); |
428 | break; | 428 | break; |
429 | case Key_G: | 429 | case Key_G: |
430 | { | 430 | { |
431 | currentPathCombo->lineEdit()->setFocus(); | 431 | currentPathCombo->lineEdit()->setFocus(); |
432 | } | 432 | } |
433 | break; | 433 | break; |
434 | 434 | ||
435 | case Key_H: | 435 | case Key_H: |
436 | showHidden(); | 436 | showHidden(); |
437 | break; | 437 | break; |
438 | case Key_I: | 438 | case Key_I: |
439 | fileStatus(); | 439 | fileStatus(); |
440 | break; | 440 | break; |
441 | case Key_M: | 441 | case Key_M: |
442 | move(); | 442 | move(); |
443 | break; | 443 | break; |
444 | case Key_N: | 444 | case Key_N: |
445 | mkDir(); | 445 | mkDir(); |
446 | break; | 446 | break; |
447 | case Key_P: | 447 | case Key_P: |
448 | filePerms(); | 448 | filePerms(); |
449 | break; | 449 | break; |
450 | case Key_R: | 450 | case Key_R: |
451 | rn(); | 451 | rn(); |
452 | break; | 452 | break; |
453 | case Key_U: | 453 | case Key_U: |
454 | upDir(); | 454 | upDir(); |
455 | break; | 455 | break; |
456 | case Key_1: | 456 | case Key_1: |
457 | switchToLocalTab(); | 457 | switchToLocalTab(); |
458 | break; | 458 | break; |
459 | case Key_2: | 459 | case Key_2: |
460 | switchToRemoteTab(); | 460 | switchToRemoteTab(); |
461 | break; | 461 | break; |
462 | case Key_3: | 462 | case Key_3: |
463 | CFButtonPushed(); | 463 | CFButtonPushed(); |
464 | break; | 464 | break; |
465 | case Key_4: | 465 | case Key_4: |
466 | SDButtonPushed(); | 466 | SDButtonPushed(); |
467 | break; | 467 | break; |
468 | case Key_5: | 468 | case Key_5: |
469 | homeButtonPushed(); | 469 | homeButtonPushed(); |
470 | break; | 470 | break; |
471 | case Key_6: | 471 | case Key_6: |
472 | docButtonPushed(); | 472 | docButtonPushed(); |
473 | break; | 473 | break; |
474 | case Key_7: | 474 | case Key_7: |
475 | break; | 475 | break; |
476 | case Key_8: | 476 | case Key_8: |
477 | break; | 477 | break; |
@@ -673,248 +673,248 @@ void AdvancedFm::addToDocs() | |||
673 | // qDebug(curFile); | 673 | // qDebug(curFile); |
674 | QFileInfo fi(curFile); | 674 | QFileInfo fi(curFile); |
675 | DocLnk f; | 675 | DocLnk f; |
676 | // curFile.replace(QRegExp("\\..*"),""); | 676 | // curFile.replace(QRegExp("\\..*"),""); |
677 | f.setName(fi.baseName() ); | 677 | f.setName(fi.baseName() ); |
678 | f.setFile( curFile); | 678 | f.setFile( curFile); |
679 | f.writeLink(); | 679 | f.writeLink(); |
680 | } | 680 | } |
681 | } | 681 | } |
682 | } | 682 | } |
683 | 683 | ||
684 | 684 | ||
685 | void AdvancedFm::customDirsToMenu() | 685 | void AdvancedFm::customDirsToMenu() |
686 | { | 686 | { |
687 | 687 | ||
688 | Config cfg("AdvancedFm"); | 688 | Config cfg("AdvancedFm"); |
689 | cfg.setGroup("Menu"); | 689 | cfg.setGroup("Menu"); |
690 | 690 | ||
691 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 691 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
692 | menuButton->insertItems(list ); | 692 | menuButton->insertItems(list ); |
693 | 693 | ||
694 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 694 | // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
695 | // { | 695 | // { |
696 | // customDirMenu->insertItem(*it ); | 696 | // customDirMenu->insertItem(*it ); |
697 | // } | 697 | // } |
698 | } | 698 | } |
699 | 699 | ||
700 | void AdvancedFm::dirMenuSelected(int item) | 700 | void AdvancedFm::dirMenuSelected(int item) |
701 | { | 701 | { |
702 | qDebug("menu item %d", item); | 702 | qDebug("menu item %d", item); |
703 | switch(item) | 703 | switch(item) |
704 | { | 704 | { |
705 | 705 | ||
706 | case -21: | 706 | case -21: |
707 | case 0: | 707 | case 0: |
708 | addCustomDir(); | 708 | addCustomDir(); |
709 | break; | 709 | break; |
710 | case -22: | 710 | case -22: |
711 | case 1: | 711 | case 1: |
712 | removeCustomDir(); | 712 | removeCustomDir(); |
713 | break; | 713 | break; |
714 | default: | 714 | default: |
715 | { | 715 | { |
716 | // gotoCustomDir( menuButton->text(item)); | 716 | // gotoCustomDir( menuButton->text(item)); |
717 | // gotoCustomDir( customDirMenu->text(item)); | 717 | // gotoCustomDir( customDirMenu->text(item)); |
718 | } | 718 | } |
719 | break; | 719 | break; |
720 | 720 | ||
721 | }; | 721 | }; |
722 | } | 722 | } |
723 | 723 | ||
724 | void AdvancedFm::addCustomDir() | 724 | void AdvancedFm::addCustomDir() |
725 | { | 725 | { |
726 | Config cfg("AdvancedFm"); | 726 | Config cfg("AdvancedFm"); |
727 | cfg.setGroup("Menu"); | 727 | cfg.setGroup("Menu"); |
728 | QString dir; | 728 | QString dir; |
729 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 729 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
730 | 730 | ||
731 | dir = CurrentDir()->canonicalPath(); | 731 | dir = CurrentDir()->canonicalPath(); |
732 | 732 | ||
733 | bool addIt=true; | 733 | bool addIt=true; |
734 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 734 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
735 | { | 735 | { |
736 | if( dir == (*it)) | 736 | if( dir == (*it)) |
737 | { | 737 | { |
738 | addIt=false; | 738 | addIt=false; |
739 | } | 739 | } |
740 | } | 740 | } |
741 | if(addIt) | 741 | if(addIt) |
742 | { | 742 | { |
743 | menuButton->insertItem(dir); | 743 | menuButton->insertItem(dir); |
744 | // customDirMenu->insertItem(dir); | 744 | // customDirMenu->insertItem(dir); |
745 | list << dir; | 745 | list << dir; |
746 | } | 746 | } |
747 | 747 | ||
748 | cfg.writeEntry("CustomDir", list, ','); | 748 | cfg.writeEntry("CustomDir", list, ','); |
749 | cfg.write(); | 749 | cfg.write(); |
750 | } | 750 | } |
751 | 751 | ||
752 | void AdvancedFm::removeCustomDir() | 752 | void AdvancedFm::removeCustomDir() |
753 | { | 753 | { |
754 | // qDebug("remove custom dir"); | 754 | // qDebug("remove custom dir"); |
755 | Config cfg("AdvancedFm"); | 755 | Config cfg("AdvancedFm"); |
756 | cfg.setGroup("Menu"); | 756 | cfg.setGroup("Menu"); |
757 | QString dir; | 757 | QString dir; |
758 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); | 758 | QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); |
759 | QStringList list2; | 759 | QStringList list2; |
760 | dir = CurrentDir()->canonicalPath(); | 760 | dir = CurrentDir()->canonicalPath(); |
761 | int ramble=2; | 761 | int ramble=2; |
762 | // int ramble=-24; | 762 | // int ramble=-24; |
763 | //first remove list | 763 | //first remove list |
764 | if(list.grep(dir,true).isEmpty()) | 764 | if(list.grep(dir,true).isEmpty()) |
765 | { | 765 | { |
766 | QMessageBox::message(tr( "AdvancedFm" ), | 766 | QMessageBox::message(tr( "AdvancedFm" ), |
767 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 767 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); |
768 | } | 768 | } |
769 | else | 769 | else |
770 | { | 770 | { |
771 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 771 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
772 | { | 772 | { |
773 | if((*it) != dir)//current item is not our current dir, so add it to temp list | 773 | if((*it) != dir)//current item is not our current dir, so add it to temp list |
774 | { | 774 | { |
775 | list2 <<(*it); | 775 | list2 <<(*it); |
776 | } | 776 | } |
777 | else | 777 | else |
778 | { | 778 | { |
779 | // customDirMenu->removeItem( ramble); | 779 | // customDirMenu->removeItem( ramble); |
780 | menuButton->remove( ramble); | 780 | menuButton->remove( ramble); |
781 | 781 | ||
782 | } | 782 | } |
783 | ramble++; | 783 | ramble++; |
784 | // ramble--; | 784 | // ramble--; |
785 | } | 785 | } |
786 | 786 | ||
787 | cfg.writeEntry("CustomDir", list2, ','); | 787 | cfg.writeEntry("CustomDir", list2, ','); |
788 | cfg.write(); | 788 | cfg.write(); |
789 | } | 789 | } |
790 | // customDirsToMenu(); | 790 | // customDirsToMenu(); |
791 | 791 | ||
792 | } | 792 | } |
793 | 793 | ||
794 | void AdvancedFm::gotoCustomDir(const QString &dir) | 794 | void AdvancedFm::gotoCustomDir(const QString &dir) |
795 | { | 795 | { |
796 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | 796 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); |
797 | // QString curDir = dir; | 797 | // QString curDir = dir; |
798 | // QDir *thisDir = CurrentDir(); | 798 | // QDir *thisDir = CurrentDir(); |
799 | // if( curDir.isEmpty()) { | 799 | // if( curDir.isEmpty()) { |
800 | // } | 800 | // } |
801 | if( dir == s_addBookmark) | 801 | if( dir == s_addBookmark) |
802 | { | 802 | { |
803 | addCustomDir(); | 803 | addCustomDir(); |
804 | } | 804 | } |
805 | if( dir == s_removeBookmark) | 805 | if( dir == s_removeBookmark) |
806 | { | 806 | { |
807 | removeCustomDir( ); | 807 | removeCustomDir( ); |
808 | } | 808 | } |
809 | else | 809 | else |
810 | { | 810 | { |
811 | gotoDirectory( dir); | 811 | gotoDirectory( dir); |
812 | // if(QDir( curDir).exists() ) | 812 | // if(QDir( curDir).exists() ) |
813 | // { | 813 | // { |
814 | // thisDir->setPath( curDir ); | 814 | // thisDir->setPath( curDir ); |
815 | // chdir( curDir.latin1() ); | 815 | // chdir( curDir.latin1() ); |
816 | // thisDir->cd( curDir, TRUE); | 816 | // thisDir->cd( curDir, TRUE); |
817 | // populateView(); | 817 | // populateView(); |
818 | // } | 818 | // } |
819 | } | 819 | } |
820 | } | 820 | } |
821 | 821 | ||
822 | QDir *AdvancedFm::CurrentDir() | 822 | QDir *AdvancedFm::CurrentDir() |
823 | { | 823 | { |
824 | if ( whichTab == 1) | 824 | if ( whichTab == 1) |
825 | { | 825 | { |
826 | return ¤tDir; | 826 | return ¤tDir; |
827 | } | 827 | } |
828 | else | 828 | else |
829 | { | 829 | { |
830 | return ¤tRemoteDir; | 830 | return ¤tRemoteDir; |
831 | } | 831 | } |
832 | } | 832 | } |
833 | 833 | ||
834 | QDir *AdvancedFm::OtherDir() | 834 | QDir *AdvancedFm::OtherDir() |
835 | { | 835 | { |
836 | if ( whichTab == 1) | 836 | if ( whichTab == 1) |
837 | { | 837 | { |
838 | return ¤tRemoteDir; | 838 | return ¤tRemoteDir; |
839 | } | 839 | } |
840 | else | 840 | else |
841 | { | 841 | { |
842 | return ¤tDir; | 842 | return ¤tDir; |
843 | } | 843 | } |
844 | } | 844 | } |
845 | 845 | ||
846 | QListView * AdvancedFm::CurrentView() | 846 | QListView * AdvancedFm::CurrentView() |
847 | { | 847 | { |
848 | if ( whichTab == 1) | 848 | if ( whichTab == 1) |
849 | return Local_View; | 849 | return Local_View; |
850 | else | 850 | else |
851 | return Remote_View; | 851 | return Remote_View; |
852 | } | 852 | } |
853 | 853 | ||
854 | QListView * AdvancedFm::OtherView() | 854 | QListView * AdvancedFm::OtherView() |
855 | { | 855 | { |
856 | if ( whichTab == 1) | 856 | if ( whichTab == 1) |
857 | return Remote_View; | 857 | return Remote_View; |
858 | else | 858 | else |
859 | return Local_View; | 859 | return Local_View; |
860 | } | 860 | } |
861 | 861 | ||
862 | void AdvancedFm::setOtherTabCurrent() | 862 | void AdvancedFm::setOtherTabCurrent() |
863 | { | 863 | { |
864 | if ( whichTab == 1) | 864 | if ( whichTab == 1) |
865 | TabWidget->setCurrentTab(1); | 865 | TabWidget->setCurrentWidget(1); |
866 | else | 866 | else |
867 | TabWidget->setCurrentTab(0); | 867 | TabWidget->setCurrentWidget(0); |
868 | } | 868 | } |
869 | 869 | ||
870 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 870 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
871 | qDebug("qcop message "+msg ); | 871 | qDebug("qcop message "+msg ); |
872 | QDataStream stream ( data, IO_ReadOnly ); | 872 | QDataStream stream ( data, IO_ReadOnly ); |
873 | if ( msg == "openDirectory(QString)" ) { | 873 | if ( msg == "openDirectory(QString)" ) { |
874 | qDebug("received"); | 874 | qDebug("received"); |
875 | QString file; | 875 | QString file; |
876 | stream >> file; | 876 | stream >> file; |
877 | gotoDirectory( (const QString &) file); | 877 | gotoDirectory( (const QString &) file); |
878 | } | 878 | } |
879 | } | 879 | } |
880 | 880 | ||
881 | void AdvancedFm::setDocument(const QString &file) { | 881 | void AdvancedFm::setDocument(const QString &file) { |
882 | gotoDirectory( file); | 882 | gotoDirectory( file); |
883 | 883 | ||
884 | } | 884 | } |
885 | 885 | ||
886 | void AdvancedFm::gotoDirectory(const QString &file) { | 886 | void AdvancedFm::gotoDirectory(const QString &file) { |
887 | 887 | ||
888 | QString curDir = file; | 888 | QString curDir = file; |
889 | QDir *thisDir = CurrentDir(); | 889 | QDir *thisDir = CurrentDir(); |
890 | if(QDir( curDir).exists() ) { | 890 | if(QDir( curDir).exists() ) { |
891 | thisDir->setPath( curDir ); | 891 | thisDir->setPath( curDir ); |
892 | chdir( curDir.latin1() ); | 892 | chdir( curDir.latin1() ); |
893 | thisDir->cd( curDir, TRUE); | 893 | thisDir->cd( curDir, TRUE); |
894 | populateView(); | 894 | populateView(); |
895 | } | 895 | } |
896 | else if(QFileInfo(curDir).exists()) { | 896 | else if(QFileInfo(curDir).exists()) { |
897 | QFileInfo fileInfo(curDir); | 897 | QFileInfo fileInfo(curDir); |
898 | curDir=fileInfo.dirPath(); | 898 | curDir=fileInfo.dirPath(); |
899 | if(QDir( curDir).exists() ) { | 899 | if(QDir( curDir).exists() ) { |
900 | thisDir->setPath( curDir ); | 900 | thisDir->setPath( curDir ); |
901 | chdir( curDir.latin1() ); | 901 | chdir( curDir.latin1() ); |
902 | thisDir->cd( curDir, TRUE); | 902 | thisDir->cd( curDir, TRUE); |
903 | populateView(); | 903 | populateView(); |
904 | } | 904 | } |
905 | findFile(file); | 905 | findFile(file); |
906 | } | 906 | } |
907 | 907 | ||
908 | } | 908 | } |
909 | 909 | ||
910 | void AdvancedFm::findFile(const QString &fileName) { | 910 | void AdvancedFm::findFile(const QString &fileName) { |
911 | QFileInfo fi(fileName); | 911 | QFileInfo fi(fileName); |
912 | QListView *thisView = CurrentView(); | 912 | QListView *thisView = CurrentView(); |
913 | QListViewItemIterator it( thisView ); | 913 | QListViewItemIterator it( thisView ); |
914 | for ( ; it.current(); ++it ) { | 914 | for ( ; it.current(); ++it ) { |
915 | if(it.current()->text(0) == fi.fileName()) { | 915 | if(it.current()->text(0) == fi.fileName()) { |
916 | it.current()->setSelected(true); | 916 | it.current()->setSelected(true); |
917 | thisView->ensureItemVisible(it.current()); | 917 | thisView->ensureItemVisible(it.current()); |
918 | } | 918 | } |
919 | } | 919 | } |
920 | } | 920 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 94d7bd7..5e2c769 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,180 +1,180 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfm.h | 2 | advancedfm.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 14 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
15 | #define QT_QWS_OPIE | 15 | #define QT_QWS_OPIE |
16 | 16 | ||
17 | //#include <opie/otabwidget.h> | 17 | //#include <opie/otabwidget.h> |
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.h> |
19 | 19 | ||
20 | #include <qpe/ir.h> | 20 | #include <qpe/ir.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qvariant.h> | 23 | #include <qvariant.h> |
24 | #include <qdialog.h> | 24 | #include <qdialog.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qpoint.h> | 29 | #include <qpoint.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qpixmap.h> | 31 | #include <qpixmap.h> |
32 | 32 | ||
33 | class OTabWidget; | 33 | class OSplitter; |
34 | class QVBoxLayout; | 34 | class QVBoxLayout; |
35 | class QHBoxLayout; | 35 | class QHBoxLayout; |
36 | class QGridLayout; | 36 | class QGridLayout; |
37 | class QComboBox; | 37 | class QComboBox; |
38 | class QListView; | 38 | class QListView; |
39 | class QListviewItem; | 39 | class QListviewItem; |
40 | class QLabel; | 40 | class QLabel; |
41 | class QProgressBar; | 41 | class QProgressBar; |
42 | class QSpinBox; | 42 | class QSpinBox; |
43 | class QTabWidget; | 43 | class QTabWidget; |
44 | class QWidget; | 44 | class QWidget; |
45 | class QPopupMenu; | 45 | class QPopupMenu; |
46 | class QFile; | 46 | class QFile; |
47 | class QListViewItem; | 47 | class QListViewItem; |
48 | class QLineEdit; | 48 | class QLineEdit; |
49 | class MenuButton; | 49 | class MenuButton; |
50 | 50 | ||
51 | class QToolButton; | 51 | class QToolButton; |
52 | class Ir; | 52 | class Ir; |
53 | 53 | ||
54 | class AdvancedFm : public QMainWindow | 54 | class AdvancedFm : public QMainWindow |
55 | { | 55 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | AdvancedFm(); | 58 | AdvancedFm(); |
59 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
60 | protected slots: | 60 | protected slots: |
61 | void selectAll(); | 61 | void selectAll(); |
62 | void addToDocs(); | 62 | void addToDocs(); |
63 | void doDirChange(); | 63 | void doDirChange(); |
64 | void mkDir(); | 64 | void mkDir(); |
65 | void del(); | 65 | void del(); |
66 | void rn(); | 66 | void rn(); |
67 | void populateView(); | 67 | void populateView(); |
68 | void rePopulate(); | 68 | void rePopulate(); |
69 | void showHidden(); | 69 | void showHidden(); |
70 | void showMenuHidden(); | 70 | void showMenuHidden(); |
71 | void writeConfig(); | 71 | void writeConfig(); |
72 | void readConfig(); | 72 | void readConfig(); |
73 | void ListClicked(QListViewItem *); | 73 | void ListClicked(QListViewItem *); |
74 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 74 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
75 | void makeDir(); | 75 | void makeDir(); |
76 | void doDelete(); | 76 | void doDelete(); |
77 | void tabChanged(QWidget*); | 77 | void tabChanged(QWidget*); |
78 | void cleanUp(); | 78 | void cleanUp(); |
79 | void renameIt(); | 79 | void renameIt(); |
80 | void runThis(); | 80 | void runThis(); |
81 | void runText(); | 81 | void runText(); |
82 | void filePerms(); | 82 | void filePerms(); |
83 | void doProperties(); | 83 | void doProperties(); |
84 | void runCommand(); | 84 | void runCommand(); |
85 | void runCommandStd(); | 85 | void runCommandStd(); |
86 | QStringList getPath(); | 86 | QStringList getPath(); |
87 | void mkSym(); | 87 | void mkSym(); |
88 | void switchToLocalTab(); | 88 | void switchToLocalTab(); |
89 | void switchToRemoteTab(); | 89 | void switchToRemoteTab(); |
90 | 90 | ||
91 | protected: | 91 | protected: |
92 | 92 | ||
93 | OTabWidget *TabWidget; | 93 | OSplitter *TabWidget; |
94 | QCopChannel * channel; | 94 | QCopChannel * channel; |
95 | QPixmap unknownXpm; | 95 | QPixmap unknownXpm; |
96 | int whichTab; | 96 | int whichTab; |
97 | // QTabWidget *TabWidget; | 97 | // QTabWidget *TabWidget; |
98 | QWidget *tab, *tab_2, *tab_3; | 98 | QWidget *tab, *tab_2, *tab_3; |
99 | QListView *Local_View, *Remote_View; | 99 | QListView *Local_View, *Remote_View; |
100 | 100 | ||
101 | QLineEdit *currentPathEdit; | 101 | QLineEdit *currentPathEdit; |
102 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 102 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
103 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 103 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
104 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 104 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
105 | QDir currentDir, currentRemoteDir; | 105 | QDir currentDir, currentRemoteDir; |
106 | QComboBox *currentPathCombo; | 106 | QComboBox *currentPathCombo; |
107 | QString filterStr, s_addBookmark, s_removeBookmark; | 107 | QString filterStr, s_addBookmark, s_removeBookmark; |
108 | QListViewItem * item; | 108 | QListViewItem * item; |
109 | bool b; | 109 | bool b; |
110 | QStringList fileSystemTypeList, fsList; | 110 | QStringList fileSystemTypeList, fsList; |
111 | int currentServerConfig; | 111 | int currentServerConfig; |
112 | bool zaurusDevice; | 112 | bool zaurusDevice; |
113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 113 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
114 | QStringList remoteDirPathStringList, localDirPathStringList; | 114 | QStringList remoteDirPathStringList, localDirPathStringList; |
115 | QLineEdit *renameBox; | 115 | QLineEdit *renameBox; |
116 | 116 | ||
117 | void init(); | 117 | void init(); |
118 | void initConnections(); | 118 | void initConnections(); |
119 | void keyReleaseEvent( QKeyEvent *); | 119 | void keyReleaseEvent( QKeyEvent *); |
120 | void keyPressEvent( QKeyEvent *); | 120 | void keyPressEvent( QKeyEvent *); |
121 | QString getFileSystemType(const QString &); | 121 | QString getFileSystemType(const QString &); |
122 | QString getDiskSpace(const QString &); | 122 | QString getDiskSpace(const QString &); |
123 | void parsetab(const QString &fileName); | 123 | void parsetab(const QString &fileName); |
124 | QString checkDiskSpace(const QString &); | 124 | QString checkDiskSpace(const QString &); |
125 | QString dealWithSymName(const QString &); | 125 | QString dealWithSymName(const QString &); |
126 | QDir *CurrentDir(); | 126 | QDir *CurrentDir(); |
127 | QDir *OtherDir(); | 127 | QDir *OtherDir(); |
128 | QListView *CurrentView(); | 128 | QListView *CurrentView(); |
129 | QListView *OtherView(); | 129 | QListView *OtherView(); |
130 | void setOtherTabCurrent(); | 130 | void setOtherTabCurrent(); |
131 | 131 | ||
132 | protected slots: | 132 | protected slots: |
133 | void dirMenuSelected(int); | 133 | void dirMenuSelected(int); |
134 | void showFileMenu(); | 134 | void showFileMenu(); |
135 | void cancelMenuTimer(); | 135 | void cancelMenuTimer(); |
136 | void homeButtonPushed(); | 136 | void homeButtonPushed(); |
137 | void docButtonPushed(); | 137 | void docButtonPushed(); |
138 | void SDButtonPushed(); | 138 | void SDButtonPushed(); |
139 | void CFButtonPushed(); | 139 | void CFButtonPushed(); |
140 | void QPEButtonPushed(); | 140 | void QPEButtonPushed(); |
141 | void upDir(); | 141 | void upDir(); |
142 | void currentPathComboChanged(); | 142 | void currentPathComboChanged(); |
143 | void copy(); | 143 | void copy(); |
144 | void copyAs(); | 144 | void copyAs(); |
145 | void copySameDir(); | 145 | void copySameDir(); |
146 | void currentPathComboActivated(const QString &); | 146 | void currentPathComboActivated(const QString &); |
147 | void fillCombo(const QString &); | 147 | void fillCombo(const QString &); |
148 | bool copyFile( const QString & , const QString & ); | 148 | bool copyFile( const QString & , const QString & ); |
149 | void move(); | 149 | void move(); |
150 | void fileStatus(); | 150 | void fileStatus(); |
151 | void doAbout(); | 151 | void doAbout(); |
152 | void doBeam(); | 152 | void doBeam(); |
153 | void fileBeamFinished( Ir *); | 153 | void fileBeamFinished( Ir *); |
154 | 154 | ||
155 | private: | 155 | private: |
156 | MenuButton *menuButton; | 156 | MenuButton *menuButton; |
157 | QString oldName; | 157 | QString oldName; |
158 | QTimer menuTimer; | 158 | QTimer menuTimer; |
159 | void startProcess(const QString &); | 159 | void startProcess(const QString &); |
160 | bool eventFilter( QObject * , QEvent * ); | 160 | bool eventFilter( QObject * , QEvent * ); |
161 | void cancelRename(); | 161 | void cancelRename(); |
162 | void doRename(QListView *); | 162 | void doRename(QListView *); |
163 | void okRename(); | 163 | void okRename(); |
164 | void customDirsToMenu(); | 164 | void customDirsToMenu(); |
165 | void addCustomDir(); | 165 | void addCustomDir(); |
166 | void removeCustomDir(); | 166 | void removeCustomDir(); |
167 | void gotoDirectory(const QString &); | 167 | void gotoDirectory(const QString &); |
168 | void openSearch(); | 168 | void openSearch(); |
169 | void findFile(const QString &); | 169 | void findFile(const QString &); |
170 | 170 | ||
171 | private slots: | 171 | private slots: |
172 | void processEnded(OProcess *); | 172 | void processEnded(OProcess *); |
173 | void oprocessStderr(OProcess *, char *, int); | 173 | void oprocessStderr(OProcess *, char *, int); |
174 | void gotoCustomDir(const QString &); | 174 | void gotoCustomDir(const QString &); |
175 | void qcopReceive(const QCString&, const QByteArray&); | 175 | void qcopReceive(const QCString&, const QByteArray&); |
176 | void setDocument(const QString &); | 176 | void setDocument(const QString &); |
177 | 177 | ||
178 | }; | 178 | }; |
179 | 179 | ||
180 | #endif // ADVANCEDFM_H | 180 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 45dc0c4..463b202 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,285 +1,286 @@ | |||
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 | #include <opie/otabwidget.h> | 14 | #include <opie/osplitter.h> |
15 | #include <qpe/storage.h> | 15 | #include <qpe/storage.h> |
16 | 16 | ||
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 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qmenubar.h> | 23 | #include <qmenubar.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | 28 | ||
29 | #include <sys/utsname.h> | 29 | #include <sys/utsname.h> |
30 | 30 | ||
31 | 31 | ||
32 | void AdvancedFm::init() { | 32 | void AdvancedFm::init() { |
33 | #if defined(QT_QWS_OPIE) | 33 | #if defined(QT_QWS_OPIE) |
34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | 35 | #endif |
36 | setCaption( tr( "AdvancedFm" ) ); | 36 | setCaption( tr( "AdvancedFm" ) ); |
37 | 37 | ||
38 | QVBoxLayout *layout = new QVBoxLayout( this ); | 38 | QVBoxLayout *layout = new QVBoxLayout( this ); |
39 | layout->setSpacing( 2); | 39 | layout->setSpacing( 2); |
40 | layout->setMargin( 2); | 40 | layout->setMargin( 2); |
41 | 41 | ||
42 | QMenuBar *menuBar = new QMenuBar(this); | 42 | QMenuBar *menuBar = new QMenuBar(this); |
43 | fileMenu = new QPopupMenu( this ); | 43 | fileMenu = new QPopupMenu( this ); |
44 | viewMenu = new QPopupMenu( this ); | 44 | viewMenu = new QPopupMenu( this ); |
45 | // customDirMenu = new QPopupMenu( this ); | 45 | // customDirMenu = new QPopupMenu( this ); |
46 | 46 | ||
47 | layout->addWidget( menuBar ); | 47 | layout->addWidget( menuBar ); |
48 | 48 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 50 | menuBar->insertItem( tr( "View" ), viewMenu); |
51 | 51 | ||
52 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 52 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
53 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 53 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
54 | cdUpButton->setAutoRaise( true ); | 54 | cdUpButton->setAutoRaise( true ); |
55 | menuBar->insertItem( cdUpButton ); | 55 | menuBar->insertItem( cdUpButton ); |
56 | 56 | ||
57 | 57 | ||
58 | QHBox *lineBox = new QHBox( this ); | 58 | QHBox *lineBox = new QHBox( this ); |
59 | 59 | ||
60 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 60 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
61 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 61 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
62 | qpeDirButton->setAutoRaise( true ); | 62 | qpeDirButton->setAutoRaise( true ); |
63 | menuBar->insertItem( qpeDirButton ); | 63 | menuBar->insertItem( qpeDirButton ); |
64 | 64 | ||
65 | cfButton = new QToolButton( 0, "CFButton"); | 65 | cfButton = new QToolButton( 0, "CFButton"); |
66 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 66 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
67 | cfButton->setAutoRaise( true ); | 67 | cfButton->setAutoRaise( true ); |
68 | menuBar->insertItem( cfButton ); | 68 | menuBar->insertItem( cfButton ); |
69 | 69 | ||
70 | sdButton = new QToolButton( 0, "SDButton"); | 70 | sdButton = new QToolButton( 0, "SDButton"); |
71 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 71 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
72 | sdButton->setAutoRaise( true ); | 72 | sdButton->setAutoRaise( true ); |
73 | menuBar->insertItem( sdButton ); | 73 | menuBar->insertItem( sdButton ); |
74 | 74 | ||
75 | docButton = new QToolButton( 0,"docsButton"); | 75 | docButton = new QToolButton( 0,"docsButton"); |
76 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 76 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
77 | docButton->setAutoRaise( true ); | 77 | docButton->setAutoRaise( true ); |
78 | menuBar->insertItem( docButton ); | 78 | menuBar->insertItem( docButton ); |
79 | 79 | ||
80 | homeButton = new QToolButton( 0, "homeButton"); | 80 | homeButton = new QToolButton( 0, "homeButton"); |
81 | homeButton->setPixmap(Resource::loadPixmap("home")); | 81 | homeButton->setPixmap(Resource::loadPixmap("home")); |
82 | homeButton->setAutoRaise( true ); | 82 | homeButton->setAutoRaise( true ); |
83 | menuBar->insertItem( homeButton ); | 83 | menuBar->insertItem( homeButton ); |
84 | 84 | ||
85 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 85 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
86 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 86 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
87 | fileMenu->insertSeparator(); | 87 | fileMenu->insertSeparator(); |
88 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 88 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
89 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 90 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
91 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 91 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
92 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 92 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
93 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 93 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
94 | fileMenu->insertSeparator(); | 94 | fileMenu->insertSeparator(); |
95 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 95 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
96 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 96 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
97 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 97 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
98 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 98 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
99 | fileMenu->setCheckable(TRUE); | 99 | fileMenu->setCheckable(TRUE); |
100 | 100 | ||
101 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 101 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
102 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 102 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
103 | // viewMenu->insertSeparator(); | 103 | // viewMenu->insertSeparator(); |
104 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 104 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
105 | viewMenu->setCheckable(TRUE); | 105 | viewMenu->setCheckable(TRUE); |
106 | 106 | ||
107 | s_addBookmark = tr("Bookmark Directory"); | 107 | s_addBookmark = tr("Bookmark Directory"); |
108 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 108 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
109 | 109 | ||
110 | // menuButton->insertItem(""); | 110 | // menuButton->insertItem(""); |
111 | 111 | ||
112 | // customDirMenu->insertItem(tr("Add This Directory")); | 112 | // customDirMenu->insertItem(tr("Add This Directory")); |
113 | // customDirMenu->insertItem(tr("Remove This Directory")); | 113 | // customDirMenu->insertItem(tr("Remove This Directory")); |
114 | // customDirMenu->insertSeparator(); | 114 | // customDirMenu->insertSeparator(); |
115 | 115 | ||
116 | menuButton = new MenuButton( lineBox ); | 116 | menuButton = new MenuButton( lineBox ); |
117 | 117 | ||
118 | menuButton->setUseLabel(false); | 118 | menuButton->setUseLabel(false); |
119 | menuButton->setMaximumWidth( 20 ); | 119 | menuButton->setMaximumWidth( 20 ); |
120 | menuButton->insertItem( s_addBookmark); | 120 | menuButton->insertItem( s_addBookmark); |
121 | menuButton->insertItem( s_removeBookmark); | 121 | menuButton->insertItem( s_removeBookmark); |
122 | menuButton->insertSeparator(); | 122 | menuButton->insertSeparator(); |
123 | 123 | ||
124 | customDirsToMenu(); | 124 | customDirsToMenu(); |
125 | 125 | ||
126 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); | 126 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); |
127 | currentPathCombo->setEditable(TRUE); | 127 | currentPathCombo->setEditable(TRUE); |
128 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 128 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
129 | 129 | ||
130 | layout->addWidget( lineBox ); | 130 | layout->addWidget( lineBox ); |
131 | 131 | ||
132 | 132 | ||
133 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); | 133 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
134 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 134 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
135 | layout->addWidget( TabWidget, 4 ); | 135 | layout->addWidget( TabWidget, 4 ); |
136 | 136 | ||
137 | tab = new QWidget( TabWidget, "tab" ); | 137 | tab = new QWidget( TabWidget, "tab" ); |
138 | tabLayout = new QGridLayout( tab ); | 138 | tabLayout = new QGridLayout( tab ); |
139 | tabLayout->setSpacing( 2); | 139 | tabLayout->setSpacing( 2); |
140 | tabLayout->setMargin( 2); | 140 | tabLayout->setMargin( 2); |
141 | 141 | ||
142 | Local_View = new QListView( tab, "Local_View" ); | 142 | Local_View = new QListView( tab, "Local_View" ); |
143 | Local_View->addColumn( tr("File"),130); | 143 | Local_View->addColumn( tr("File"),130); |
144 | Local_View->addColumn( tr("Size"),-1); | 144 | Local_View->addColumn( tr("Size"),-1); |
145 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 145 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
146 | Local_View->addColumn( tr("Date"),-1); | 146 | Local_View->addColumn( tr("Date"),-1); |
147 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 147 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
148 | Local_View->setAllColumnsShowFocus(TRUE); | 148 | Local_View->setAllColumnsShowFocus(TRUE); |
149 | Local_View->setMultiSelection( TRUE ); | 149 | Local_View->setMultiSelection( TRUE ); |
150 | Local_View->setSelectionMode(QListView::Extended); | 150 | Local_View->setSelectionMode(QListView::Extended); |
151 | 151 | ||
152 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 152 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
153 | 153 | ||
154 | tabLayout->addWidget( Local_View, 0, 0 ); | 154 | tabLayout->addWidget( Local_View, 0, 0 ); |
155 | 155 | ||
156 | TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); | 156 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
157 | // TabWidget->insertTab( tab, tr("1")); | 157 | // TabWidget->insertTab( tab, tr("1")); |
158 | 158 | ||
159 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 159 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
160 | tabLayout_2 = new QGridLayout( tab_2 ); | 160 | tabLayout_2 = new QGridLayout( tab_2 ); |
161 | tabLayout_2->setSpacing( 2); | 161 | tabLayout_2->setSpacing( 2); |
162 | tabLayout_2->setMargin( 2); | 162 | tabLayout_2->setMargin( 2); |
163 | 163 | ||
164 | Remote_View = new QListView( tab_2, "Remote_View" ); | 164 | Remote_View = new QListView( tab_2, "Remote_View" ); |
165 | Remote_View->addColumn( tr("File"),130); | 165 | Remote_View->addColumn( tr("File"),130); |
166 | Remote_View->addColumn( tr("Size"),-1); | 166 | Remote_View->addColumn( tr("Size"),-1); |
167 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 167 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
168 | Remote_View->addColumn( tr("Date"),-1); | 168 | Remote_View->addColumn( tr("Date"),-1); |
169 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 169 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
170 | Remote_View->setAllColumnsShowFocus(TRUE); | 170 | Remote_View->setAllColumnsShowFocus(TRUE); |
171 | Remote_View->setMultiSelection( TRUE ); | 171 | Remote_View->setMultiSelection( TRUE ); |
172 | Remote_View->setSelectionMode(QListView::Extended); | 172 | Remote_View->setSelectionMode(QListView::Extended); |
173 | 173 | ||
174 | 174 | ||
175 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 175 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
176 | 176 | ||
177 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 177 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
178 | 178 | ||
179 | TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 179 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
180 | TabWidget->setSizeChange( 370 ); | ||
180 | // TabWidget->insertTab( tab_2, tr( "2")); | 181 | // TabWidget->insertTab( tab_2, tr( "2")); |
181 | 182 | ||
182 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 183 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
183 | tabLayout_3 = new QGridLayout( tab_3 ); | 184 | tabLayout_3 = new QGridLayout( tab_3 ); |
184 | tabLayout_3->setSpacing( 2); | 185 | tabLayout_3->setSpacing( 2); |
185 | tabLayout_3->setMargin( 2); | 186 | tabLayout_3->setMargin( 2); |
186 | 187 | ||
187 | 188 | ||
188 | // OFileDialog fileDialog; | 189 | // OFileDialog fileDialog; |
189 | // fileDialog; | 190 | // fileDialog; |
190 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 191 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
191 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 192 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
192 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 193 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
193 | 194 | ||
194 | QListView *fileTree; | 195 | QListView *fileTree; |
195 | fileTree = new QListView( tab_3, "tree" ); | 196 | fileTree = new QListView( tab_3, "tree" ); |
196 | 197 | ||
197 | 198 | ||
198 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 199 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
199 | 200 | ||
200 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 201 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
201 | */ | 202 | */ |
202 | 203 | ||
203 | /////////////// | 204 | /////////////// |
204 | 205 | ||
205 | 206 | ||
206 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 207 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
207 | if (uname(&name) != -1) { | 208 | if (uname(&name) != -1) { |
208 | QString release=name.release; | 209 | QString release=name.release; |
209 | if(release.find("embedix",0,TRUE) !=-1) { | 210 | if(release.find("embedix",0,TRUE) !=-1) { |
210 | zaurusDevice=TRUE; | 211 | zaurusDevice=TRUE; |
211 | } else { | 212 | } else { |
212 | zaurusDevice=FALSE; | 213 | zaurusDevice=FALSE; |
213 | } | 214 | } |
214 | } | 215 | } |
215 | 216 | ||
216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 217 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
217 | qDebug("not have sd"); | 218 | qDebug("not have sd"); |
218 | sdButton->hide(); | 219 | sdButton->hide(); |
219 | } | 220 | } |
220 | if( !StorageInfo::hasCf() ) { | 221 | if( !StorageInfo::hasCf() ) { |
221 | qDebug("not have cf"); | 222 | qDebug("not have cf"); |
222 | cfButton->hide(); | 223 | cfButton->hide(); |
223 | } | 224 | } |
224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 225 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
225 | currentDir.setPath( QDir::currentDirPath()); | 226 | currentDir.setPath( QDir::currentDirPath()); |
226 | 227 | ||
227 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 228 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
228 | currentRemoteDir.setPath( QDir::currentDirPath()); | 229 | currentRemoteDir.setPath( QDir::currentDirPath()); |
229 | 230 | ||
230 | // b = TRUE; | 231 | // b = TRUE; |
231 | 232 | ||
232 | filterStr="*"; | 233 | filterStr="*"; |
233 | b=FALSE; | 234 | b=FALSE; |
234 | showMenuHidden(); | 235 | showMenuHidden(); |
235 | TabWidget->setCurrentTab(0); | 236 | TabWidget->setCurrentWidget(0); |
236 | 237 | ||
237 | } | 238 | } |
238 | 239 | ||
239 | void AdvancedFm::initConnections() | 240 | void AdvancedFm::initConnections() |
240 | { | 241 | { |
241 | 242 | ||
242 | connect( qApp,SIGNAL( aboutToQuit()), | 243 | connect( qApp,SIGNAL( aboutToQuit()), |
243 | this, SLOT( cleanUp()) ); | 244 | this, SLOT( cleanUp()) ); |
244 | connect( qpeDirButton ,SIGNAL(released()), | 245 | connect( qpeDirButton ,SIGNAL(released()), |
245 | this,SLOT( QPEButtonPushed()) ); | 246 | this,SLOT( QPEButtonPushed()) ); |
246 | connect( cfButton ,SIGNAL(released()), | 247 | connect( cfButton ,SIGNAL(released()), |
247 | this,SLOT( CFButtonPushed()) ); | 248 | this,SLOT( CFButtonPushed()) ); |
248 | connect( sdButton ,SIGNAL(released()), | 249 | connect( sdButton ,SIGNAL(released()), |
249 | this,SLOT( SDButtonPushed()) ); | 250 | this,SLOT( SDButtonPushed()) ); |
250 | connect( cdUpButton ,SIGNAL(released()), | 251 | connect( cdUpButton ,SIGNAL(released()), |
251 | this,SLOT( upDir()) ); | 252 | this,SLOT( upDir()) ); |
252 | connect( docButton,SIGNAL(released()), | 253 | connect( docButton,SIGNAL(released()), |
253 | this,SLOT( docButtonPushed()) ); | 254 | this,SLOT( docButtonPushed()) ); |
254 | connect( homeButton,SIGNAL(released()), | 255 | connect( homeButton,SIGNAL(released()), |
255 | this,SLOT( homeButtonPushed()) ); | 256 | this,SLOT( homeButtonPushed()) ); |
256 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 257 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
257 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 258 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
258 | 259 | ||
259 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 260 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
260 | this,SLOT(currentPathComboChanged())); | 261 | this,SLOT(currentPathComboChanged())); |
261 | 262 | ||
262 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 263 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
263 | this,SLOT( ListClicked(QListViewItem *)) ); | 264 | this,SLOT( ListClicked(QListViewItem *)) ); |
264 | 265 | ||
265 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 266 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
266 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 267 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
267 | 268 | ||
268 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 269 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
269 | 270 | ||
270 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 271 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
271 | this,SLOT( ListClicked(QListViewItem *)) ); | 272 | this,SLOT( ListClicked(QListViewItem *)) ); |
272 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 273 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
273 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 274 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
274 | 275 | ||
275 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), | 276 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), |
276 | this,SLOT(tabChanged(QWidget*))); | 277 | this,SLOT(tabChanged(QWidget*))); |
277 | 278 | ||
278 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 279 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
279 | 280 | ||
280 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | 281 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); |
281 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | 282 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); |
282 | 283 | ||
283 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 284 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
284 | 285 | ||
285 | } | 286 | } |