author | drw <drw> | 2005-03-02 19:32:43 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-02 19:32:43 (UTC) |
commit | 9f3e0913c7b01c1e14f907e756999b9d9bf9ceef (patch) (unidiff) | |
tree | c117c38bbbeb630adbe2f25025ff97dc02475a88 | |
parent | af157881a6265b1ea9e74d61853c2d3d865a6080 (diff) | |
download | opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.zip opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.tar.gz opie-9f3e0913c7b01c1e14f907e756999b9d9bf9ceef.tar.bz2 |
Scale icons approprtely
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 56e3282..fd81313 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,362 +1,362 @@ | |||
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 | 16 | ||
17 | #include <opie2/ostorageinfo.h> | 17 | #include <opie2/ostorageinfo.h> |
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qpe/mimetype.h> | 21 | #include <qpe/mimetype.h> |
22 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/menubutton.h> | 24 | #include <qpe/menubutton.h> |
25 | 25 | ||
26 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
27 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
34 | #include <time.h> | 34 | #include <time.h> |
35 | #include <dirent.h> | 35 | #include <dirent.h> |
36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
37 | #include <sys/vfs.h> | 37 | #include <sys/vfs.h> |
38 | #include <mntent.h> | 38 | #include <mntent.h> |
39 | 39 | ||
40 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
41 | 41 | ||
42 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 42 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
43 | : QMainWindow( ) { | 43 | : QMainWindow( ) { |
44 | init(); | 44 | init(); |
45 | renameBox = 0; | 45 | renameBox = 0; |
46 | whichTab = 1; | 46 | whichTab = 1; |
47 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); | 47 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); |
48 | 48 | ||
49 | initConnections(); | 49 | initConnections(); |
50 | rePopulate(); | 50 | rePopulate(); |
51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
52 | 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&))); |
53 | switchToLocalTab(); | 53 | switchToLocalTab(); |
54 | } | 54 | } |
55 | 55 | ||
56 | AdvancedFm::~AdvancedFm() { | 56 | AdvancedFm::~AdvancedFm() { |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | void AdvancedFm::cleanUp() { | 60 | void AdvancedFm::cleanUp() { |
61 | QString sfile=QDir::homeDirPath(); | 61 | QString sfile=QDir::homeDirPath(); |
62 | if(sfile.right(1) != "/") | 62 | if(sfile.right(1) != "/") |
63 | sfile+="/._temp"; | 63 | sfile+="/._temp"; |
64 | else | 64 | else |
65 | sfile+="._temp"; | 65 | sfile+="._temp"; |
66 | QFile file( sfile); | 66 | QFile file( sfile); |
67 | if(file.exists()) | 67 | if(file.exists()) |
68 | file.remove(); | 68 | file.remove(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void AdvancedFm::tabChanged(QWidget *wd) { | 71 | void AdvancedFm::tabChanged(QWidget *wd) { |
72 | if(wd == tab) { | 72 | if(wd == tab) { |
73 | whichTab = 1; | 73 | whichTab = 1; |
74 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 74 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
75 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 75 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
76 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); | 76 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); |
77 | } | 77 | } |
78 | 78 | ||
79 | else if(wd == tab_2) { | 79 | else if(wd == tab_2) { |
80 | whichTab = 2; | 80 | whichTab = 2; |
81 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 81 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
82 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 82 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
83 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); | 83 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); |
84 | } | 84 | } |
85 | qApp->processEvents(); | 85 | qApp->processEvents(); |
86 | QString path = CurrentDir()->canonicalPath(); | 86 | QString path = CurrentDir()->canonicalPath(); |
87 | 87 | ||
88 | chdir( path.latin1()); | 88 | chdir( path.latin1()); |
89 | currentPathCombo->lineEdit()->setText(path); | 89 | currentPathCombo->lineEdit()->setText(path); |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | void AdvancedFm::populateView() { | 93 | void AdvancedFm::populateView() { |
94 | 94 | ||
95 | QPixmap pm; | 95 | QPixmap pm; |
96 | QListView *thisView = CurrentView(); | 96 | QListView *thisView = CurrentView(); |
97 | QDir *thisDir = CurrentDir(); | 97 | QDir *thisDir = CurrentDir(); |
98 | QString path = thisDir->canonicalPath(); | 98 | QString path = thisDir->canonicalPath(); |
99 | 99 | ||
100 | thisView->clear(); | 100 | thisView->clear(); |
101 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 101 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
102 | thisDir->setMatchAllDirs(TRUE); | 102 | thisDir->setMatchAllDirs(TRUE); |
103 | thisDir->setNameFilter(filterStr); | 103 | thisDir->setNameFilter(filterStr); |
104 | QString fileL, fileS, fileDate; | 104 | QString fileL, fileS, fileDate; |
105 | 105 | ||
106 | QString fs = getFileSystemType((const QString &) path); | 106 | QString fs = getFileSystemType((const QString &) path); |
107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
109 | bool isDir = FALSE; | 109 | bool isDir = FALSE; |
110 | 110 | ||
111 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 111 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
112 | QFileInfoListIterator it(*list); | 112 | QFileInfoListIterator it(*list); |
113 | QFileInfo *fi; | 113 | QFileInfo *fi; |
114 | while ( (fi=it.current()) ) { | 114 | while ( (fi=it.current()) ) { |
115 | if (fi->isSymLink() ) { | 115 | if (fi->isSymLink() ) { |
116 | QString symLink = fi->readLink(); | 116 | QString symLink = fi->readLink(); |
117 | QFileInfo sym( symLink); | 117 | QFileInfo sym( symLink); |
118 | fileS.sprintf( "%10i", sym.size() ); | 118 | fileS.sprintf( "%10i", sym.size() ); |
119 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 119 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
120 | fileDate = sym.lastModified().toString(); | 120 | fileDate = sym.lastModified().toString(); |
121 | } else { | 121 | } else { |
122 | fileS.sprintf( "%10i", fi->size() ); | 122 | fileS.sprintf( "%10i", fi->size() ); |
123 | fileL = fi->fileName(); | 123 | fileL = fi->fileName(); |
124 | fileDate= fi->lastModified().toString(); | 124 | fileDate= fi->lastModified().toString(); |
125 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 125 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
126 | // if(fileL == "..") | 126 | // if(fileL == "..") |
127 | fileL += "/"; | 127 | fileL += "/"; |
128 | isDir=TRUE; | 128 | isDir=TRUE; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | QFileInfo fileInfo( path + "/" + fileL); | 131 | QFileInfo fileInfo( path + "/" + fileL); |
132 | 132 | ||
133 | if(fileL !="./" && fi->exists()) { | 133 | if(fileL !="./" && fi->exists()) { |
134 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 134 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
135 | 135 | ||
136 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 136 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
137 | 137 | ||
138 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 138 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
139 | pm = Resource::loadPixmap( "lockedfolder" ); | 139 | pm.convertFromImage( Resource::loadImage( "lockedfolder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
140 | else | 140 | else |
141 | pm= Resource::loadPixmap( "folder" ); | 141 | pm.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
142 | } | 142 | } |
143 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 143 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
144 | pm = Resource::loadPixmap( "exec"); | 144 | pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
145 | } | 145 | } |
146 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 146 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
147 | | fileInfo.permission( QFileInfo::ExeGroup) | 147 | | fileInfo.permission( QFileInfo::ExeGroup) |
148 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 148 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
149 | pm = Resource::loadPixmap( "exec"); | 149 | pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
150 | } | 150 | } |
151 | else if( !fi->isReadable() ) { | 151 | else if( !fi->isReadable() ) { |
152 | pm = Resource::loadPixmap( "locked" ); | 152 | pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
153 | } | 153 | } |
154 | else { //everything else goes by mimetype | 154 | else { //everything else goes by mimetype |
155 | MimeType mt(fi->filePath()); | 155 | MimeType mt(fi->filePath()); |
156 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 156 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
157 | if(pm.isNull()) { | 157 | if(pm.isNull()) { |
158 | pm = unknownXpm; | 158 | pm = unknownXpm; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 161 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
162 | // odebug << " overlay link image" << oendl; | 162 | // odebug << " overlay link image" << oendl; |
163 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 163 | pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
164 | // pm= Resource::loadPixmap( "folder" ); | 164 | // pm= Resource::loadPixmap( "folder" ); |
165 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 165 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
166 | // QPainter painter( &pm ); | 166 | // QPainter painter( &pm ); |
167 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 167 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
168 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 168 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
169 | } | 169 | } |
170 | item->setPixmap( 0,pm); | 170 | item->setPixmap( 0, pm ); |
171 | 171 | ||
172 | } | 172 | } |
173 | isDir=FALSE; | 173 | isDir=FALSE; |
174 | ++it; | 174 | ++it; |
175 | } | 175 | } |
176 | 176 | ||
177 | if( path.find("dev",0,TRUE) != -1) { | 177 | if( path.find("dev",0,TRUE) != -1) { |
178 | struct stat buf; | 178 | struct stat buf; |
179 | dev_t devT; | 179 | dev_t devT; |
180 | DIR *dir; | 180 | DIR *dir; |
181 | struct dirent *mydirent; | 181 | struct dirent *mydirent; |
182 | 182 | ||
183 | if((dir = opendir( path.latin1())) != NULL) | 183 | if((dir = opendir( path.latin1())) != NULL) |
184 | while ((mydirent = readdir(dir)) != NULL) { | 184 | while ((mydirent = readdir(dir)) != NULL) { |
185 | lstat( mydirent->d_name, &buf); | 185 | lstat( mydirent->d_name, &buf); |
186 | // odebug << mydirent->d_name << oendl; | 186 | // odebug << mydirent->d_name << oendl; |
187 | fileL.sprintf("%s", mydirent->d_name); | 187 | fileL.sprintf("%s", mydirent->d_name); |
188 | devT = buf.st_dev; | 188 | devT = buf.st_dev; |
189 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 189 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
190 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 190 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
191 | if( fileL.find(".") == -1 ) { | 191 | if( fileL.find(".") == -1 ) { |
192 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 192 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
193 | pm = unknownXpm; | 193 | pm = unknownXpm; |
194 | item->setPixmap( 0,pm); | 194 | item->setPixmap( 0,pm); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | closedir(dir); | 198 | closedir(dir); |
199 | } | 199 | } |
200 | 200 | ||
201 | thisView->setSorting( 3,FALSE); | 201 | thisView->setSorting( 3,FALSE); |
202 | fillCombo( (const QString &) path ); | 202 | fillCombo( (const QString &) path ); |
203 | } | 203 | } |
204 | 204 | ||
205 | void AdvancedFm::rePopulate() { | 205 | void AdvancedFm::rePopulate() { |
206 | // qDebug("repopulate views"); | 206 | // qDebug("repopulate views"); |
207 | populateView(); | 207 | populateView(); |
208 | setOtherTabCurrent(); | 208 | setOtherTabCurrent(); |
209 | populateView(); | 209 | populateView(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 212 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
213 | if(selectedItem) { | 213 | if(selectedItem) { |
214 | QString strItem=selectedItem->text(0); | 214 | QString strItem=selectedItem->text(0); |
215 | // owarn << strItem << oendl; | 215 | // owarn << strItem << oendl; |
216 | QString strSize=selectedItem->text(1); | 216 | QString strSize=selectedItem->text(1); |
217 | strSize=strSize.stripWhiteSpace(); | 217 | strSize=strSize.stripWhiteSpace(); |
218 | bool isDirectory = false; | 218 | bool isDirectory = false; |
219 | QString strItem2; | 219 | QString strItem2; |
220 | 220 | ||
221 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | 221 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
222 | strItem2 = dealWithSymName((const QString&)strItem); | 222 | strItem2 = dealWithSymName((const QString&)strItem); |
223 | if(QDir(strItem2).exists() ) | 223 | if(QDir(strItem2).exists() ) |
224 | strItem = strItem2; | 224 | strItem = strItem2; |
225 | } | 225 | } |
226 | 226 | ||
227 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 227 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
228 | 228 | ||
229 | if(QDir(strItem).exists()) | 229 | if(QDir(strItem).exists()) |
230 | isDirectory = true; | 230 | isDirectory = true; |
231 | } | 231 | } |
232 | 232 | ||
233 | if( isDirectory ) { | 233 | if( isDirectory ) { |
234 | CurrentDir()->cd( strItem, TRUE); | 234 | CurrentDir()->cd( strItem, TRUE); |
235 | populateView(); | 235 | populateView(); |
236 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 236 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
237 | } | 237 | } |
238 | chdir( strItem.latin1()); | 238 | chdir( strItem.latin1()); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 242 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
243 | Q_UNUSED(item); | 243 | Q_UNUSED(item); |
244 | switch (mouse) { | 244 | switch (mouse) { |
245 | case 1: | 245 | case 1: |
246 | { | 246 | { |
247 | if(renameBox != 0 ) { | 247 | if(renameBox != 0 ) { |
248 | cancelRename(); | 248 | cancelRename(); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | break; | 251 | break; |
252 | // case 2: | 252 | // case 2: |
253 | // menuTimer.start( 50, TRUE ); | 253 | // menuTimer.start( 50, TRUE ); |
254 | // break; | 254 | // break; |
255 | }; | 255 | }; |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | void AdvancedFm::refreshCurrentTab() { | 259 | void AdvancedFm::refreshCurrentTab() { |
260 | populateView(); | 260 | populateView(); |
261 | // if ( TabWidget->currentWidget() == tab) { | 261 | // if ( TabWidget->currentWidget() == tab) { |
262 | } | 262 | } |
263 | 263 | ||
264 | void AdvancedFm::switchToLocalTab() { | 264 | void AdvancedFm::switchToLocalTab() { |
265 | TabWidget->setCurrentWidget(tab); | 265 | TabWidget->setCurrentWidget(tab); |
266 | Local_View->setFocus(); | 266 | Local_View->setFocus(); |
267 | // whichTab = 1; | 267 | // whichTab = 1; |
268 | } | 268 | } |
269 | 269 | ||
270 | void AdvancedFm::switchToRemoteTab() { | 270 | void AdvancedFm::switchToRemoteTab() { |
271 | TabWidget->setCurrentWidget(tab_2); | 271 | TabWidget->setCurrentWidget(tab_2); |
272 | Remote_View->setFocus(); | 272 | Remote_View->setFocus(); |
273 | // whichTab = 2; | 273 | // whichTab = 2; |
274 | } | 274 | } |
275 | 275 | ||
276 | void AdvancedFm::currentPathComboChanged() { | 276 | void AdvancedFm::currentPathComboChanged() { |
277 | QString pDir = currentPathCombo->lineEdit()->text(); | 277 | QString pDir = currentPathCombo->lineEdit()->text(); |
278 | if(QDir(pDir).exists()) { | 278 | if(QDir(pDir).exists()) { |
279 | CurrentDir()->setPath(pDir ); | 279 | CurrentDir()->setPath(pDir ); |
280 | populateView(); | 280 | populateView(); |
281 | } else { | 281 | } else { |
282 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); | 282 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 286 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
287 | 287 | ||
288 | if ( TabWidget->currentWidget() == tab) { | 288 | if ( TabWidget->currentWidget() == tab) { |
289 | // if ( whichTab == 1) { | 289 | // if ( whichTab == 1) { |
290 | currentPathCombo->lineEdit()->setText( currentPath); | 290 | currentPathCombo->lineEdit()->setText( currentPath); |
291 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 291 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
292 | currentPathCombo->clear(); | 292 | currentPathCombo->clear(); |
293 | localDirPathStringList.prepend( currentPath ); | 293 | localDirPathStringList.prepend( currentPath ); |
294 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 294 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
295 | } | 295 | } |
296 | } else { | 296 | } else { |
297 | currentPathCombo->lineEdit()->setText( currentPath); | 297 | currentPathCombo->lineEdit()->setText( currentPath); |
298 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 298 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
299 | currentPathCombo->clear(); | 299 | currentPathCombo->clear(); |
300 | remoteDirPathStringList.prepend( currentPath ); | 300 | remoteDirPathStringList.prepend( currentPath ); |
301 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 301 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | QStringList AdvancedFm::getPath() { | 306 | QStringList AdvancedFm::getPath() { |
307 | QStringList strList; | 307 | QStringList strList; |
308 | QListView *thisView=CurrentView(); | 308 | QListView *thisView=CurrentView(); |
309 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 309 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
310 | QListViewItemIterator it( thisView ); | 310 | QListViewItemIterator it( thisView ); |
311 | for ( ; it.current(); ++it ) { | 311 | for ( ; it.current(); ++it ) { |
312 | if ( it.current()->isSelected() ) { | 312 | if ( it.current()->isSelected() ) { |
313 | strList << it.current()->text(0); | 313 | strList << it.current()->text(0); |
314 | // odebug << it.current()->text(0) << oendl; | 314 | // odebug << it.current()->text(0) << oendl; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | return strList; | 317 | return strList; |
318 | } | 318 | } |
319 | 319 | ||
320 | void AdvancedFm::changeTo(const QString &dir) { | 320 | void AdvancedFm::changeTo(const QString &dir) { |
321 | chdir( dir.latin1()); | 321 | chdir( dir.latin1()); |
322 | CurrentDir()->cd(dir, TRUE); | 322 | CurrentDir()->cd(dir, TRUE); |
323 | populateView(); | 323 | populateView(); |
324 | update(); | 324 | update(); |
325 | } | 325 | } |
326 | 326 | ||
327 | void AdvancedFm::homeButtonPushed() { | 327 | void AdvancedFm::homeButtonPushed() { |
328 | changeTo(QDir::homeDirPath()); | 328 | changeTo(QDir::homeDirPath()); |
329 | } | 329 | } |
330 | 330 | ||
331 | void AdvancedFm::docButtonPushed() { | 331 | void AdvancedFm::docButtonPushed() { |
332 | changeTo(QPEApplication::documentDir()); | 332 | changeTo(QPEApplication::documentDir()); |
333 | } | 333 | } |
334 | 334 | ||
335 | void AdvancedFm::SDButtonPushed() { | 335 | void AdvancedFm::SDButtonPushed() { |
336 | Opie::Core::OStorageInfo info; | 336 | Opie::Core::OStorageInfo info; |
337 | changeTo(info.sdPath()); | 337 | changeTo(info.sdPath()); |
338 | } | 338 | } |
339 | 339 | ||
340 | void AdvancedFm::CFButtonPushed() { | 340 | void AdvancedFm::CFButtonPushed() { |
341 | Opie::Core::OStorageInfo info; | 341 | Opie::Core::OStorageInfo info; |
342 | changeTo(info.cfPath()); | 342 | changeTo(info.cfPath()); |
343 | } | 343 | } |
344 | 344 | ||
345 | void AdvancedFm::QPEButtonPushed() { | 345 | void AdvancedFm::QPEButtonPushed() { |
346 | changeTo(QPEApplication::qpeDir()); | 346 | changeTo(QPEApplication::qpeDir()); |
347 | } | 347 | } |
348 | 348 | ||
349 | void AdvancedFm::doAbout() { | 349 | void AdvancedFm::doAbout() { |
350 | 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>")); | 350 | 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>")); |
351 | } | 351 | } |
352 | 352 | ||
353 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 353 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
354 | Q_UNUSED(e); | 354 | Q_UNUSED(e); |
355 | } | 355 | } |
356 | 356 | ||
357 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 357 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
358 | // if( CurrentView()->hasFocus() ) | 358 | // if( CurrentView()->hasFocus() ) |
359 | // e->ignore(); | 359 | // e->ignore(); |
360 | 360 | ||
361 | if( currentPathCombo->lineEdit()->hasFocus()) { | 361 | if( currentPathCombo->lineEdit()->hasFocus()) { |
362 | // qDebug("shout!"); | 362 | // qDebug("shout!"); |