author | llornkcor <llornkcor> | 2004-09-25 01:51:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 01:51:26 (UTC) |
commit | 40e681bf20db4f1e02212ae6e42a349ee000cf14 (patch) (unidiff) | |
tree | 86eea5377011775ff87ca50e1fd125ff8f30622f | |
parent | 0fe000754035c737ff0de97e5b2bd2cf03c16337 (diff) | |
download | opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.zip opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.tar.gz opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.tar.bz2 |
fix stuff
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 399 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 79 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 60 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 197 |
5 files changed, 361 insertions, 376 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 4de7d38..02898de 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -36,27 +36,26 @@ | |||
36 | 36 | ||
37 | using namespace Opie::Ui; | 37 | using namespace Opie::Ui; |
38 | 38 | ||
39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
40 | : QMainWindow( ) { | 40 | : QMainWindow( ) { |
41 | init(); | 41 | init(); |
42 | renameBox = 0; | 42 | renameBox = 0; |
43 | 43 | ||
44 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 44 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); |
45 | 45 | ||
46 | initConnections(); | 46 | initConnections(); |
47 | 47 | ||
48 | whichTab = 1; | 48 | whichTab = 1; |
49 | populateView(); | 49 | populateView(); |
50 | // rePopulate(); | 50 | // rePopulate(); |
51 | // currentPathCombo->setFocus(); | 51 | // currentPathCombo->setFocus(); |
52 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 52 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
53 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 53 | connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); |
54 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | ||
55 | 54 | ||
56 | // if( CurrentView() == Local_View) | 55 | // if( CurrentView() == Local_View) |
57 | // qDebug("LOCAL VIEW"); | 56 | // qDebug("LOCAL VIEW"); |
58 | // else | 57 | // else |
59 | // qDebug("REMOTE VIEW"); | 58 | // qDebug("REMOTE VIEW"); |
60 | switchToLocalTab(); | 59 | switchToLocalTab(); |
61 | } | 60 | } |
62 | 61 | ||
@@ -71,206 +70,205 @@ void AdvancedFm::cleanUp() { | |||
71 | else | 70 | else |
72 | sfile+="._temp"; | 71 | sfile+="._temp"; |
73 | QFile file( sfile); | 72 | QFile file( sfile); |
74 | if(file.exists()) | 73 | if(file.exists()) |
75 | file.remove(); | 74 | file.remove(); |
76 | } | 75 | } |
77 | 76 | ||
78 | void AdvancedFm::tabChanged(QWidget *wd) { | 77 | void AdvancedFm::tabChanged(QWidget *wd) { |
79 | if(wd == tab) | 78 | // qDebug("tabChanged"); |
80 | odebug << "LOCAL VIEW SHOWN"<< oendl; | 79 | if(wd == tab) { |
81 | else if(wd == tab_2) | 80 | whichTab = 1; |
82 | odebug<< "REMOTE VIEW SHOWN"<< oendl; | 81 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); |
83 | 82 | } | |
84 | QString path = CurrentDir()->canonicalPath(); | 83 | else if(wd == tab_2) { |
85 | currentPathCombo->lineEdit()->setText( path ); | 84 | whichTab = 2; |
86 | 85 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); | |
87 | if ( TabWidget->currentWidget() == tab) { | 86 | } |
88 | // if(whichTab == 1) { | 87 | qApp->processEvents(); |
89 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 88 | QString path = CurrentDir()->canonicalPath(); |
90 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 89 | // qDebug(path); |
91 | } else { | 90 | if ( TabWidget->currentWidget() == tab) { |
92 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 91 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 92 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
94 | } | 93 | } else { |
95 | 94 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | |
96 | QString fs= getFileSystemType( (const QString &) path); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
97 | 96 | } | |
98 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 97 | |
99 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 98 | QString fs= getFileSystemType( (const QString &) path); |
100 | chdir( path.latin1()); | 99 | |
101 | if( wd == Local_View) { | 100 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
102 | Remote_View->clearFocus(); | 101 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
103 | } else { | 102 | chdir( path.latin1()); |
104 | Local_View->clearFocus(); | 103 | currentPathCombo->lineEdit()->setText(path); |
105 | } | ||
106 | |||
107 | } | 104 | } |
108 | 105 | ||
109 | 106 | ||
110 | void AdvancedFm::populateView() { | 107 | void AdvancedFm::populateView() { |
111 | 108 | ||
112 | QPixmap pm; | 109 | QPixmap pm; |
113 | QListView *thisView = CurrentView(); | 110 | QListView *thisView = CurrentView(); |
114 | QDir *thisDir = CurrentDir(); | 111 | QDir *thisDir = CurrentDir(); |
115 | QString path = thisDir->canonicalPath(); | 112 | QString path = thisDir->canonicalPath(); |
116 | 113 | ||
117 | thisView->clear(); | 114 | thisView->clear(); |
118 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 115 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
119 | thisDir->setMatchAllDirs(TRUE); | 116 | thisDir->setMatchAllDirs(TRUE); |
120 | thisDir->setNameFilter(filterStr); | 117 | thisDir->setNameFilter(filterStr); |
121 | QString fileL, fileS, fileDate; | 118 | QString fileL, fileS, fileDate; |
122 | QString fs= getFileSystemType((const QString &) path); | 119 | QString fs= getFileSystemType((const QString &) path); |
123 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 120 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
124 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 121 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
125 | bool isDir=FALSE; | 122 | bool isDir=FALSE; |
126 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 123 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
127 | QFileInfoListIterator it(*list); | 124 | QFileInfoListIterator it(*list); |
128 | QFileInfo *fi; | 125 | QFileInfo *fi; |
129 | while ( (fi=it.current()) ) { | 126 | while ( (fi=it.current()) ) { |
130 | if (fi->isSymLink() ) { | 127 | if (fi->isSymLink() ) { |
131 | QString symLink=fi->readLink(); | 128 | QString symLink=fi->readLink(); |
132 | QFileInfo sym( symLink); | 129 | QFileInfo sym( symLink); |
133 | fileS.sprintf( "%10i", sym.size() ); | 130 | fileS.sprintf( "%10i", sym.size() ); |
134 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 131 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
135 | fileDate = sym.lastModified().toString(); | 132 | fileDate = sym.lastModified().toString(); |
136 | } else { | 133 | } else { |
137 | fileS.sprintf( "%10i", fi->size() ); | 134 | fileS.sprintf( "%10i", fi->size() ); |
138 | fileL = fi->fileName(); | 135 | fileL = fi->fileName(); |
139 | fileDate= fi->lastModified().toString(); | 136 | fileDate= fi->lastModified().toString(); |
140 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 137 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
141 | // if(fileL == "..") | 138 | // if(fileL == "..") |
142 | fileL += "/"; | 139 | fileL += "/"; |
143 | isDir=TRUE; | 140 | isDir=TRUE; |
144 | } | 141 | } |
145 | } | 142 | } |
146 | QFileInfo fileInfo( path + "/" + fileL); | 143 | QFileInfo fileInfo( path + "/" + fileL); |
147 | 144 | ||
148 | if(fileL !="./" && fi->exists()) { | 145 | if(fileL !="./" && fi->exists()) { |
149 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 146 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
150 | 147 | ||
151 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 148 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
152 | 149 | ||
153 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 150 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
154 | pm = Resource::loadPixmap( "lockedfolder" ); | 151 | pm = Resource::loadPixmap( "lockedfolder" ); |
155 | else | 152 | else |
156 | pm= Resource::loadPixmap( "folder" ); | 153 | pm= Resource::loadPixmap( "folder" ); |
157 | } | 154 | } |
158 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 155 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
159 | pm = Resource::loadPixmap( "exec"); | 156 | pm = Resource::loadPixmap( "exec"); |
160 | } | 157 | } |
161 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 158 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
162 | | fileInfo.permission( QFileInfo::ExeGroup) | 159 | | fileInfo.permission( QFileInfo::ExeGroup) |
163 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 160 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
164 | pm = Resource::loadPixmap( "exec"); | 161 | pm = Resource::loadPixmap( "exec"); |
165 | } | 162 | } |
166 | else if( !fi->isReadable() ) { | 163 | else if( !fi->isReadable() ) { |
167 | pm = Resource::loadPixmap( "locked" ); | 164 | pm = Resource::loadPixmap( "locked" ); |
168 | } | 165 | } |
169 | else { //everything else goes by mimetype | 166 | else { //everything else goes by mimetype |
170 | MimeType mt(fi->filePath()); | 167 | MimeType mt(fi->filePath()); |
171 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 168 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
172 | if(pm.isNull()) { | 169 | if(pm.isNull()) { |
173 | pm = unknownXpm; | 170 | pm = unknownXpm; |
174 | } | 171 | } |
175 | } | 172 | } |
176 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 173 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
177 | // odebug << " overlay link image" << oendl; | 174 | // odebug << " overlay link image" << oendl; |
178 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 175 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
179 | // pm= Resource::loadPixmap( "folder" ); | 176 | // pm= Resource::loadPixmap( "folder" ); |
180 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 177 | // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
181 | // QPainter painter( &pm ); | 178 | // QPainter painter( &pm ); |
182 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 179 | // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
183 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); | 180 | // pm.setMask( pm.createHeuristicMask( FALSE ) ); |
184 | } | 181 | } |
185 | item->setPixmap( 0,pm); | 182 | item->setPixmap( 0,pm); |
186 | 183 | ||
187 | } | 184 | } |
188 | isDir=FALSE; | 185 | isDir=FALSE; |
189 | ++it; | 186 | ++it; |
190 | } | 187 | } |
191 | 188 | ||
192 | if( path.find("dev",0,TRUE) != -1) { | 189 | if( path.find("dev",0,TRUE) != -1) { |
193 | struct stat buf; | 190 | struct stat buf; |
194 | dev_t devT; | 191 | dev_t devT; |
195 | DIR *dir; | 192 | DIR *dir; |
196 | struct dirent *mydirent; | 193 | struct dirent *mydirent; |
197 | 194 | ||
198 | if((dir = opendir( path.latin1())) != NULL) | 195 | if((dir = opendir( path.latin1())) != NULL) |
199 | while ((mydirent = readdir(dir)) != NULL) { | 196 | while ((mydirent = readdir(dir)) != NULL) { |
200 | lstat( mydirent->d_name, &buf); | 197 | lstat( mydirent->d_name, &buf); |
201 | // odebug << mydirent->d_name << oendl; | 198 | // odebug << mydirent->d_name << oendl; |
202 | fileL.sprintf("%s", mydirent->d_name); | 199 | fileL.sprintf("%s", mydirent->d_name); |
203 | devT = buf.st_dev; | 200 | devT = buf.st_dev; |
204 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 201 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
205 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 202 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
206 | if( fileL.find(".") == -1 ) { | 203 | if( fileL.find(".") == -1 ) { |
207 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 204 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
208 | pm = unknownXpm; | 205 | pm = unknownXpm; |
209 | item->setPixmap( 0,pm); | 206 | item->setPixmap( 0,pm); |
210 | } | 207 | } |
211 | } | 208 | } |
212 | 209 | ||
213 | closedir(dir); | 210 | closedir(dir); |
214 | } | 211 | } |
215 | 212 | ||
216 | thisView->setSorting( 3,FALSE); | 213 | thisView->setSorting( 3,FALSE); |
217 | fillCombo( (const QString &) path ); | 214 | fillCombo( (const QString &) path ); |
218 | } | 215 | } |
219 | 216 | ||
220 | void AdvancedFm::rePopulate() { | 217 | void AdvancedFm::rePopulate() { |
221 | populateView(); | 218 | // qDebug("repopulate views"); |
222 | setOtherTabCurrent(); | 219 | populateView(); |
223 | populateView(); | 220 | setOtherTabCurrent(); |
221 | populateView(); | ||
224 | 222 | ||
225 | // int tmpTab = whichTab; | 223 | // int tmpTab = whichTab; |
226 | // // odebug << "" << tmpTab << "" << oendl; | 224 | // // odebug << "" << tmpTab << "" << oendl; |
227 | 225 | ||
228 | // for(int i =1; i < 3; i++) { | 226 | // for(int i =1; i < 3; i++) { |
229 | // TabWidget->setCurrentWidget(i - 1); | 227 | // TabWidget->setCurrentWidget(i - 1); |
230 | // populateView(); | 228 | // populateView(); |
231 | // } | 229 | // } |
232 | // TabWidget->setCurrentWidget( tmpTab - 1); | 230 | // TabWidget->setCurrentWidget( tmpTab - 1); |
233 | } | 231 | } |
234 | 232 | ||
235 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 233 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
236 | if ( TabWidget->currentWidget() == tab) | 234 | // if ( TabWidget->currentWidget() == tab) |
237 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); | 235 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); |
238 | else | 236 | // else |
239 | qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); | 237 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); |
240 | 238 | ||
241 | 239 | ||
242 | if(selectedItem) { | 240 | if(selectedItem) { |
243 | QString strItem=selectedItem->text(0); | 241 | QString strItem=selectedItem->text(0); |
244 | // owarn << strItem << oendl; | 242 | // owarn << strItem << oendl; |
245 | QString strSize=selectedItem->text(1); | 243 | QString strSize=selectedItem->text(1); |
246 | strSize=strSize.stripWhiteSpace(); | 244 | strSize=strSize.stripWhiteSpace(); |
247 | bool isDirectory = false; | 245 | bool isDirectory = false; |
248 | QString strItem2; | 246 | QString strItem2; |
249 | |||
250 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | ||
251 | strItem2 = dealWithSymName((const QString&)strItem); | ||
252 | if(QDir(strItem2).exists() ) | ||
253 | strItem = strItem2; | ||
254 | } | ||
255 | 247 | ||
256 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 248 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
249 | strItem2 = dealWithSymName((const QString&)strItem); | ||
250 | if(QDir(strItem2).exists() ) | ||
251 | strItem = strItem2; | ||
252 | } | ||
257 | 253 | ||
258 | if(QDir(strItem).exists()) | 254 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
259 | isDirectory = true; | ||
260 | } | ||
261 | 255 | ||
262 | if( isDirectory ) { | 256 | if(QDir(strItem).exists()) |
263 | CurrentDir()->cd( strItem, TRUE); | 257 | isDirectory = true; |
264 | populateView(); | 258 | } |
265 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 259 | |
266 | } | 260 | if( isDirectory ) { |
267 | chdir( strItem.latin1()); | 261 | CurrentDir()->cd( strItem, TRUE); |
268 | } | 262 | populateView(); |
263 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | ||
264 | } | ||
265 | chdir( strItem.latin1()); | ||
266 | } | ||
269 | } | 267 | } |
270 | 268 | ||
271 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 269 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
272 | Q_UNUSED(item); | 270 | Q_UNUSED(item); |
273 | switch (mouse) { | 271 | switch (mouse) { |
274 | case 1: | 272 | case 1: |
275 | { | 273 | { |
276 | if(renameBox != 0 ) { | 274 | if(renameBox != 0 ) { |
@@ -287,24 +285,28 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in | |||
287 | 285 | ||
288 | void AdvancedFm::refreshCurrentTab() { | 286 | void AdvancedFm::refreshCurrentTab() { |
289 | populateView(); | 287 | populateView(); |
290 | // if ( TabWidget->currentWidget() == tab) { | 288 | // if ( TabWidget->currentWidget() == tab) { |
291 | 289 | ||
292 | } | 290 | } |
293 | 291 | ||
294 | void AdvancedFm::switchToLocalTab() { | 292 | void AdvancedFm::switchToLocalTab() { |
293 | qDebug("switchToLocal "); | ||
295 | TabWidget->setCurrentWidget(0); | 294 | TabWidget->setCurrentWidget(0); |
296 | Local_View->setFocus(); | 295 | Local_View->setFocus(); |
296 | whichTab = 1; | ||
297 | 297 | ||
298 | } | 298 | } |
299 | 299 | ||
300 | void AdvancedFm::switchToRemoteTab() { | 300 | void AdvancedFm::switchToRemoteTab() { |
301 | qDebug("switchToRemoteTab() "); | ||
301 | TabWidget->setCurrentWidget(1); | 302 | TabWidget->setCurrentWidget(1); |
302 | Remote_View->setFocus(); | 303 | Remote_View->setFocus(); |
304 | whichTab = 2; | ||
303 | } | 305 | } |
304 | 306 | ||
305 | void AdvancedFm::readConfig() { | 307 | void AdvancedFm::readConfig() { |
306 | Config cfg("AdvancedFm"); | 308 | Config cfg("AdvancedFm"); |
307 | } | 309 | } |
308 | 310 | ||
309 | void AdvancedFm::writeConfig() { | 311 | void AdvancedFm::writeConfig() { |
310 | Config cfg("AdvancedFm"); | 312 | Config cfg("AdvancedFm"); |
@@ -393,20 +395,17 @@ void AdvancedFm::CFButtonPushed() { | |||
393 | chdir( current.latin1() ); | 395 | chdir( current.latin1() ); |
394 | CurrentDir()->cd( current, TRUE); | 396 | CurrentDir()->cd( current, TRUE); |
395 | populateView(); | 397 | populateView(); |
396 | update(); | 398 | update(); |
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | void AdvancedFm::doAbout() { | 402 | void AdvancedFm::doAbout() { |
401 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 403 | 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>")); |
402 | "is copyright 2002-2003 by\n" | ||
403 | "L.J.Potter<llornkcor@handhelds.org>\n" | ||
404 | "and is licensed by the GPL")); | ||
405 | } | 404 | } |
406 | 405 | ||
407 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 406 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
408 | // owarn << "key " << e->key() << "" << oendl; | 407 | // owarn << "key " << e->key() << "" << oendl; |
409 | // if( CurrentView()->hasFocus() ) | 408 | // if( CurrentView()->hasFocus() ) |
410 | { | 409 | { |
411 | switch ( e->key() ) { | 410 | switch ( e->key() ) { |
412 | case Key_Left: | 411 | case Key_Left: |
@@ -563,74 +562,73 @@ QString AdvancedFm::getDiskSpace( const QString &path) { | |||
563 | return ""; | 562 | return ""; |
564 | } | 563 | } |
565 | 564 | ||
566 | 565 | ||
567 | void AdvancedFm::showFileMenu() { | 566 | void AdvancedFm::showFileMenu() { |
568 | QString curApp; | 567 | QString curApp; |
569 | curApp = CurrentView()->currentItem()->text(0); | 568 | curApp = CurrentView()->currentItem()->text(0); |
570 | 569 | ||
571 | MimeType mt( curApp ); | 570 | MimeType mt(curApp); |
572 | const AppLnk* app = mt.application(); | 571 | const AppLnk* app = mt.application(); |
573 | QFile fi(curApp); | 572 | QFile fi(curApp); |
574 | QPopupMenu *m = new QPopupMenu(0); | 573 | QPopupMenu *m = new QPopupMenu(0); |
575 | QPopupMenu *n = new QPopupMenu(0); | 574 | QPopupMenu *n = new QPopupMenu(0); |
576 | // QPopupMenu *o = new QPopupMenu(0); | 575 | // QPopupMenu *o = new QPopupMenu(0); |
577 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 576 | m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden())); |
578 | 577 | ||
579 | if ( QFileInfo(fi).isDir() ) { | 578 | if ( QFileInfo(fi).isDir()) { |
580 | m->insertSeparator(); | 579 | m->insertSeparator(); |
581 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); | 580 | m->insertItem(tr("Change Directory"),this,SLOT(doDirChange())); |
582 | } else { | 581 | } else { |
583 | 582 | ||
584 | if ( app ) | 583 | if (app) |
585 | m->insertItem( app->pixmap(), tr( "Open in " | 584 | m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); |
586 | + app->name() ), this, SLOT( runThis() ) ); | 585 | else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
587 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 586 | m->insertItem(tr("Execute"),this,SLOT(runThis())); |
588 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 587 | m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); |
589 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | ||
590 | } | 588 | } |
591 | 589 | ||
592 | m->insertItem(tr("Actions"),n); | 590 | m->insertItem(tr("Actions"),n); |
593 | n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); | 591 | n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); |
594 | 592 | ||
595 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 593 | n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); |
596 | 594 | ||
597 | n->insertSeparator(); | 595 | n->insertSeparator(); |
598 | n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); | 596 | n->insertItem(tr("Rename"),this,SLOT(renameIt())); |
599 | 597 | ||
600 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 598 | n->insertItem(tr("Copy"),this,SLOT(copyTimer())); |
601 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 599 | n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); |
602 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 600 | n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); |
603 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 601 | n->insertItem(tr("Move"),this,SLOT(moveTimer())); |
604 | 602 | ||
605 | n->insertSeparator(); | 603 | n->insertSeparator(); |
606 | n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); | 604 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); |
607 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 605 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); |
608 | 606 | ||
609 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 607 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); |
610 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 608 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); |
611 | 609 | ||
612 | m->insertSeparator(); | 610 | m->insertSeparator(); |
613 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 611 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); |
614 | 612 | ||
615 | #if defined(QT_QWS_OPIE) | 613 | #if defined(QT_QWS_OPIE) |
616 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 614 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); |
617 | #endif | 615 | #endif |
618 | m->setCheckable(TRUE); | 616 | m->setCheckable(TRUE); |
619 | if (!b) | 617 | if (!b) |
620 | m->setItemChecked(m->idAt(0),TRUE); | 618 | m->setItemChecked(m->idAt(0),TRUE); |
621 | else | 619 | else |
622 | m->setItemChecked(m->idAt(0),FALSE); | 620 | m->setItemChecked(m->idAt(0),FALSE); |
623 | 621 | ||
624 | if(Ir::supported()) | 622 | if(Ir::supported()) |
625 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 623 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); |
626 | m->setFocus(); | 624 | m->setFocus(); |
627 | 625 | ||
628 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 626 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); |
629 | 627 | ||
630 | if(m) delete m; | 628 | if(m) delete m; |
631 | } | 629 | } |
632 | 630 | ||
633 | 631 | ||
634 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 632 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
635 | struct statfs fss; | 633 | struct statfs fss; |
636 | if ( !statfs( path.latin1(), &fss ) ) { | 634 | if ( !statfs( path.latin1(), &fss ) ) { |
@@ -783,67 +781,62 @@ void AdvancedFm::gotoCustomDir(const QString &dir) { | |||
783 | // chdir( curDir.latin1() ); | 781 | // chdir( curDir.latin1() ); |
784 | // thisDir->cd( curDir, TRUE); | 782 | // thisDir->cd( curDir, TRUE); |
785 | // populateView(); | 783 | // populateView(); |
786 | // } | 784 | // } |
787 | } | 785 | } |
788 | } | 786 | } |
789 | 787 | ||
790 | QDir *AdvancedFm::CurrentDir() { | 788 | QDir *AdvancedFm::CurrentDir() { |
791 | |||
792 | if ( TabWidget->currentWidget() == tab) | ||
793 | qDebug("CurrentTab is Local"); | ||
794 | else | ||
795 | qDebug("CurrentTab is Remote"); | ||
796 | |||
797 | if ( whichTab == 1) { | 789 | if ( whichTab == 1) { |
790 | // qDebug("CurrentTab is Local"); | ||
798 | return ¤tDir; | 791 | return ¤tDir; |
799 | } else { | 792 | } else { |
793 | // qDebug("CurrentTab is Remote"); | ||
800 | return ¤tRemoteDir; | 794 | return ¤tRemoteDir; |
801 | } | 795 | } |
802 | } | 796 | } |
803 | 797 | ||
804 | QDir *AdvancedFm::OtherDir() { | 798 | QDir *AdvancedFm::OtherDir() { |
805 | // if ( TabWidget->currentWidget() == tab) { | 799 | // if ( TabWidget->currentWidget() == tab) { |
806 | if ( whichTab == 1) { | 800 | if ( whichTab == 1) { |
807 | return ¤tRemoteDir; | 801 | return ¤tRemoteDir; |
808 | } else { | 802 | } else { |
809 | return ¤tDir; | 803 | return ¤tDir; |
810 | } | 804 | } |
811 | } | 805 | } |
812 | 806 | ||
813 | QListView * AdvancedFm::CurrentView() { | 807 | QListView * AdvancedFm::CurrentView() { |
814 | if ( TabWidget->currentWidget() == tab) | ||
815 | odebug << "CurrentView local" << oendl; | ||
816 | |||
817 | // if ( TabWidget->currentWidget() == tab) { | 808 | // if ( TabWidget->currentWidget() == tab) { |
818 | if ( whichTab == 1) { | 809 | if ( whichTab == 1) { |
810 | // qDebug("CurrentView: local"); | ||
819 | return Local_View; | 811 | return Local_View; |
820 | } else { | 812 | } else { |
821 | // owarn << "CurrentView Tab 2" << oendl; | 813 | // owarn << "CurrentView Tab 2" << oendl; |
814 | // qDebug("CurrentView: remote"); | ||
822 | return Remote_View; | 815 | return Remote_View; |
823 | } | 816 | } |
824 | } | 817 | } |
825 | 818 | ||
826 | QListView * AdvancedFm::OtherView() { | 819 | QListView * AdvancedFm::OtherView() { |
827 | if ( whichTab == 1) | 820 | if ( whichTab == 1) |
828 | return Remote_View; | 821 | return Remote_View; |
829 | else | 822 | else |
830 | return Local_View; | 823 | return Local_View; |
831 | } | 824 | } |
832 | 825 | ||
833 | void AdvancedFm::setOtherTabCurrent() { | 826 | void AdvancedFm::setOtherTabCurrent() { |
834 | qDebug("setOtherTabCurrent() %d",whichTab); | 827 | // qDebug("setOtherTabCurrent() %d",whichTab); |
835 | if ( whichTab == 1) { | 828 | if ( whichTab == 1) { |
836 | TabWidget->setCurrentWidget(1); | 829 | TabWidget->setCurrentWidget(1); |
837 | } else { | 830 | } else { |
838 | TabWidget->setCurrentWidget(0); | 831 | TabWidget->setCurrentWidget(0); |
839 | } | 832 | } |
840 | OtherView()->setFocus(); | 833 | OtherView()->setFocus(); |
841 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 834 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
842 | } | 835 | } |
843 | 836 | ||
844 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 837 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
845 | // odebug << "qcop message "+msg << oendl; | 838 | // odebug << "qcop message "+msg << oendl; |
846 | QDataStream stream ( data, IO_ReadOnly ); | 839 | QDataStream stream ( data, IO_ReadOnly ); |
847 | if ( msg == "openDirectory(QString)" ) { | 840 | if ( msg == "openDirectory(QString)" ) { |
848 | // odebug << "received" << oendl; | 841 | // odebug << "received" << oendl; |
849 | QString file; | 842 | QString file; |
@@ -853,17 +846,17 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | |||
853 | } | 846 | } |
854 | 847 | ||
855 | void AdvancedFm::setDocument(const QString &file) { | 848 | void AdvancedFm::setDocument(const QString &file) { |
856 | gotoDirectory( file); | 849 | gotoDirectory( file); |
857 | 850 | ||
858 | } | 851 | } |
859 | 852 | ||
860 | void AdvancedFm::gotoDirectory(const QString &file) { | 853 | void AdvancedFm::gotoDirectory(const QString &file) { |
861 | qDebug("goto dir "+file); | 854 | // qDebug("goto dir "+file); |
862 | QString curDir = file; | 855 | QString curDir = file; |
863 | QDir *thisDir = CurrentDir(); | 856 | QDir *thisDir = CurrentDir(); |
864 | if(QDir( curDir).exists() ) { | 857 | if(QDir( curDir).exists() ) { |
865 | thisDir->setPath( curDir ); | 858 | thisDir->setPath( curDir ); |
866 | chdir( curDir.latin1() ); | 859 | chdir( curDir.latin1() ); |
867 | thisDir->cd( curDir, TRUE); | 860 | thisDir->cd( curDir, TRUE); |
868 | populateView(); | 861 | populateView(); |
869 | } | 862 | } |
@@ -888,17 +881,17 @@ void AdvancedFm::findFile(const QString &fileName) { | |||
888 | for ( ; it.current(); ++it ) { | 881 | for ( ; it.current(); ++it ) { |
889 | if(it.current()->text(0) == fi.fileName()) { | 882 | if(it.current()->text(0) == fi.fileName()) { |
890 | it.current()->setSelected(true); | 883 | it.current()->setSelected(true); |
891 | thisView->ensureItemVisible(it.current()); | 884 | thisView->ensureItemVisible(it.current()); |
892 | } | 885 | } |
893 | } | 886 | } |
894 | } | 887 | } |
895 | 888 | ||
896 | void AdvancedFm::slotSwitchMenu(int ) { | 889 | void AdvancedFm::slotSwitchMenu(int item) { |
897 | // odebug << "Switch " << item << "" << oendl; | 890 | // qDebug( "Switch %d",item); |
898 | // viewMenu->setItemChecked(item, true); | 891 | // viewMenu->setItemChecked(item, true); |
899 | } | 892 | } |
900 | 893 | ||
901 | void AdvancedFm::navigateToSelected() { | 894 | void AdvancedFm::navigateToSelected() { |
902 | if( !CurrentView()->currentItem()) return; | 895 | if( !CurrentView()->currentItem()) return; |
903 | doDirChange(); | 896 | doDirChange(); |
904 | } | 897 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index def6fe2..2234b3c 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -52,48 +52,16 @@ class Ir; | |||
52 | 52 | ||
53 | class AdvancedFm : public QMainWindow | 53 | class AdvancedFm : public QMainWindow |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | static QString appName() { return QString::fromLatin1("advancedfm"); } | 57 | static QString appName() { return QString::fromLatin1("advancedfm"); } |
58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); | 58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); |
59 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
60 | protected slots: | ||
61 | void slotSwitchMenu(int); | ||
62 | void selectAll(); | ||
63 | void addToDocs(); | ||
64 | void doDirChange(); | ||
65 | void mkDir(); | ||
66 | void del(); | ||
67 | void rn(); | ||
68 | void populateView(); | ||
69 | void rePopulate(); | ||
70 | void showHidden(); | ||
71 | void showMenuHidden(); | ||
72 | void writeConfig(); | ||
73 | void readConfig(); | ||
74 | void ListClicked(QListViewItem *); | ||
75 | void ListPressed( int, QListViewItem *, const QPoint&, int); | ||
76 | void makeDir(); | ||
77 | void doDelete(); | ||
78 | void tabChanged(QWidget*); | ||
79 | void cleanUp(); | ||
80 | void renameIt(); | ||
81 | void runThis(); | ||
82 | void runText(); | ||
83 | void filePerms(); | ||
84 | void doProperties(); | ||
85 | void runCommand(); | ||
86 | void runCommandStd(); | ||
87 | QStringList getPath(); | ||
88 | void mkSym(); | ||
89 | void switchToLocalTab(); | ||
90 | void switchToRemoteTab(); | ||
91 | void refreshCurrentTab(); | ||
92 | protected: | 60 | protected: |
93 | 61 | ||
94 | Opie::Ui::OSplitter *TabWidget; | 62 | Opie::Ui::OSplitter *TabWidget; |
95 | QCopChannel * channel; | 63 | QCopChannel * channel; |
96 | QPixmap unknownXpm; | 64 | QPixmap unknownXpm; |
97 | int whichTab; | 65 | int whichTab; |
98 | // QTabWidget *TabWidget; | 66 | // QTabWidget *TabWidget; |
99 | QWidget *tab, *tab_2, *tab_3; | 67 | QWidget *tab, *tab_2, *tab_3; |
@@ -125,48 +93,88 @@ protected: | |||
125 | QString checkDiskSpace(const QString &); | 93 | QString checkDiskSpace(const QString &); |
126 | QString dealWithSymName(const QString &); | 94 | QString dealWithSymName(const QString &); |
127 | QDir *CurrentDir(); | 95 | QDir *CurrentDir(); |
128 | QDir *OtherDir(); | 96 | QDir *OtherDir(); |
129 | QListView *CurrentView(); | 97 | QListView *CurrentView(); |
130 | QListView *OtherView(); | 98 | QListView *OtherView(); |
131 | void setOtherTabCurrent(); | 99 | void setOtherTabCurrent(); |
132 | 100 | ||
101 | //protected signals: | ||
102 | // void newPath(QString); | ||
103 | |||
133 | protected slots: | 104 | protected slots: |
105 | void slotSwitchMenu(int); | ||
106 | void selectAll(); | ||
107 | void addToDocs(); | ||
108 | void doDirChange(); | ||
109 | void mkDir(); | ||
110 | void del(); | ||
111 | void rn(); | ||
112 | void populateView(); | ||
113 | void rePopulate(); | ||
114 | void showHidden(); | ||
115 | void showMenuHidden(); | ||
116 | void writeConfig(); | ||
117 | void readConfig(); | ||
118 | void ListClicked(QListViewItem *); | ||
119 | void ListPressed( int, QListViewItem *, const QPoint&, int); | ||
120 | void makeDir(); | ||
121 | void doDelete(); | ||
122 | void tabChanged(QWidget*); | ||
123 | void cleanUp(); | ||
124 | void renameIt(); | ||
125 | void runThis(); | ||
126 | void runText(); | ||
127 | void filePerms(); | ||
128 | void doProperties(); | ||
129 | void runCommand(); | ||
130 | void runCommandStd(); | ||
131 | QStringList getPath(); | ||
132 | void mkSym(); | ||
133 | void switchToLocalTab(); | ||
134 | void switchToRemoteTab(); | ||
135 | void refreshCurrentTab(); | ||
134 | 136 | ||
135 | void openSearch(); | 137 | void openSearch(); |
136 | void dirMenuSelected(int); | 138 | void dirMenuSelected(int); |
137 | void showFileMenu(); | 139 | void showFileMenu(); |
138 | void homeButtonPushed(); | 140 | void homeButtonPushed(); |
139 | void docButtonPushed(); | 141 | void docButtonPushed(); |
140 | void SDButtonPushed(); | 142 | void SDButtonPushed(); |
141 | void CFButtonPushed(); | 143 | void CFButtonPushed(); |
142 | void QPEButtonPushed(); | 144 | void QPEButtonPushed(); |
143 | void upDir(); | 145 | void upDir(); |
144 | void currentPathComboChanged(); | 146 | void currentPathComboChanged(); |
147 | |||
145 | void copy(); | 148 | void copy(); |
149 | void copyTimer(); | ||
146 | void copyAs(); | 150 | void copyAs(); |
151 | void copyAsTimer(); | ||
147 | void copySameDir(); | 152 | void copySameDir(); |
148 | void currentPathComboActivated(const QString &); | 153 | void copySameDirTimer(); |
154 | void move(); | ||
155 | void moveTimer(); | ||
156 | |||
157 | void currentPathComboActivated(const QString &); | ||
149 | void fillCombo(const QString &); | 158 | void fillCombo(const QString &); |
150 | bool copyFile( const QString & , const QString & ); | 159 | bool copyFile( const QString & , const QString & ); |
151 | void move(); | ||
152 | void fileStatus(); | 160 | void fileStatus(); |
153 | void doAbout(); | 161 | void doAbout(); |
154 | void doBeam(); | 162 | void doBeam(); |
155 | void fileBeamFinished( Ir *); | 163 | void fileBeamFinished( Ir *); |
156 | bool copyDirectory( const QString & , const QString & ); | 164 | bool copyDirectory( const QString & , const QString & ); |
157 | // void navigateToSelected(); | 165 | // void navigateToSelected(); |
158 | bool moveDirectory( const QString & , const QString & ); | 166 | bool moveDirectory( const QString & , const QString & ); |
159 | 167 | ||
160 | // void slotSwitchtoLocal(int); | 168 | // void slotSwitchtoLocal(int); |
161 | 169 | ||
162 | private: | 170 | private: |
163 | MenuButton *menuButton; | 171 | MenuButton *menuButton; |
164 | QString oldName; | 172 | QString oldName, localViewDir, remoteViewDir; |
165 | void startProcess(const QString &); | 173 | void startProcess(const QString &); |
166 | bool eventFilter( QObject * , QEvent * ); | 174 | bool eventFilter( QObject * , QEvent * ); |
167 | void cancelRename(); | 175 | void cancelRename(); |
168 | void doRename(QListView *); | 176 | void doRename(QListView *); |
169 | void okRename(); | 177 | void okRename(); |
170 | void customDirsToMenu(); | 178 | void customDirsToMenu(); |
171 | void addCustomDir(); | 179 | void addCustomDir(); |
172 | void removeCustomDir(); | 180 | void removeCustomDir(); |
@@ -175,12 +183,13 @@ private: | |||
175 | void findFile(const QString &); | 183 | void findFile(const QString &); |
176 | 184 | ||
177 | private slots: | 185 | private slots: |
178 | void processEnded(Opie::Core::OProcess *); | 186 | void processEnded(Opie::Core::OProcess *); |
179 | void oprocessStderr(Opie::Core::OProcess *, char *, int); | 187 | void oprocessStderr(Opie::Core::OProcess *, char *, int); |
180 | void gotoCustomDir(const QString &); | 188 | void gotoCustomDir(const QString &); |
181 | void qcopReceive(const QCString&, const QByteArray&); | 189 | void qcopReceive(const QCString&, const QByteArray&); |
182 | void setDocument(const QString &); | 190 | void setDocument(const QString &); |
191 | // void doMenu(int | ||
183 | 192 | ||
184 | }; | 193 | }; |
185 | 194 | ||
186 | #endif // ADVANCEDFM_H | 195 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 0644edb..713f61c 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on quick-app | 2 | CONFIG += qte warn_on quick-app |
3 | HEADERS = advancedfm.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe -lqte -lopiecore2 -lopieui2 | 8 | LIBS += -lqpe -lqte -lopiecore2 -lopieui2 |
9 | 9 | ||
10 | !contains(CONFIG,quick-app) { | 10 | !contains(CONFIG,quick-app) { |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 1802571..d2e1d8e 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -243,54 +243,38 @@ void AdvancedFm::init() { | |||
243 | showMenuHidden(); | 243 | showMenuHidden(); |
244 | TabWidget->setCurrentWidget(0); | 244 | TabWidget->setCurrentWidget(0); |
245 | 245 | ||
246 | } | 246 | } |
247 | 247 | ||
248 | void AdvancedFm::initConnections() | 248 | void AdvancedFm::initConnections() |
249 | { | 249 | { |
250 | 250 | ||
251 | connect( qApp,SIGNAL( aboutToQuit()), | 251 | connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(cleanUp())); |
252 | this, SLOT( cleanUp()) ); | 252 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
253 | connect( qpeDirButton ,SIGNAL(released()), | 253 | connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) ); |
254 | this,SLOT( QPEButtonPushed()) ); | 254 | connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) ); |
255 | connect( cfButton ,SIGNAL(released()), | 255 | connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) ); |
256 | this,SLOT( CFButtonPushed()) ); | 256 | connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) ); |
257 | connect( sdButton ,SIGNAL(released()), | 257 | connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) ); |
258 | this,SLOT( SDButtonPushed()) ); | 258 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( currentPathComboActivated(const QString&) ) ); |
259 | connect( cdUpButton ,SIGNAL(released()), | 259 | |
260 | this,SLOT( upDir()) ); | 260 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); |
261 | connect( docButton,SIGNAL(released()), | 261 | |
262 | this,SLOT( docButtonPushed()) ); | 262 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) ); |
263 | connect( homeButton,SIGNAL(released()), | 263 | |
264 | this,SLOT( homeButtonPushed()) ); | 264 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
265 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 265 | |
266 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 266 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) ); |
267 | 267 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | |
268 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 268 | |
269 | this,SLOT(currentPathComboChanged())); | 269 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), this,SLOT(tabChanged(QWidget*))); |
270 | 270 | ||
271 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 271 | connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), this, SLOT(showFileMenu())); |
272 | this,SLOT( ListClicked(QListViewItem*)) ); | 272 | connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), this, SLOT(showFileMenu())); |
273 | |||
274 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | ||
275 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | ||
276 | |||
277 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | ||
278 | this,SLOT( ListClicked(QListViewItem*)) ); | ||
279 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | ||
280 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | ||
281 | |||
282 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), | ||
283 | this,SLOT(tabChanged(QWidget*))); | ||
284 | |||
285 | connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)), | ||
286 | this, SLOT(showFileMenu())); | ||
287 | connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)), | ||
288 | this, SLOT(showFileMenu())); | ||
289 | 273 | ||
290 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); | 274 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); |
291 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); | 275 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); |
292 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); | 276 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); |
293 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 277 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
294 | 278 | ||
295 | } | 279 | } |
296 | 280 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 8d04c68..5a46579 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -266,19 +266,22 @@ void AdvancedFm::upDir() { | |||
266 | current = dir.canonicalPath(); | 266 | current = dir.canonicalPath(); |
267 | chdir( current.latin1() ); | 267 | chdir( current.latin1() ); |
268 | thisDir->cd( current, TRUE); | 268 | thisDir->cd( current, TRUE); |
269 | 269 | ||
270 | populateView(); | 270 | populateView(); |
271 | update(); | 271 | update(); |
272 | } | 272 | } |
273 | 273 | ||
274 | void AdvancedFm::copyTimer() { | ||
275 | QTimer::singleShot(125,this,SLOT(copy())); | ||
276 | } | ||
277 | |||
274 | void AdvancedFm::copy() { | 278 | void AdvancedFm::copy() { |
275 | qApp->processEvents(); | 279 | QStringList curFileList = getPath(); |
276 | QStringList curFileList = getPath(); | ||
277 | 280 | ||
278 | QDir *thisDir = CurrentDir(); | 281 | QDir *thisDir = CurrentDir(); |
279 | QDir *thatDir = OtherDir(); | 282 | QDir *thatDir = OtherDir(); |
280 | 283 | ||
281 | bool doMsg=true; | 284 | bool doMsg=true; |
282 | int count=curFileList.count(); | 285 | int count=curFileList.count(); |
283 | if( count > 0) { | 286 | if( count > 0) { |
284 | if(count > 1 ){ | 287 | if(count > 1 ){ |
@@ -307,87 +310,93 @@ void AdvancedFm::copy() { | |||
307 | 310 | ||
308 | // odebug << "Destination file is "+destFile << oendl; | 311 | // odebug << "Destination file is "+destFile << oendl; |
309 | // odebug << "CurrentFile file is " + curFile << oendl; | 312 | // odebug << "CurrentFile file is " + curFile << oendl; |
310 | 313 | ||
311 | QFile f(destFile); | 314 | QFile f(destFile); |
312 | if( f.exists()) { | 315 | if( f.exists()) { |
313 | if(doMsg) { | 316 | if(doMsg) { |
314 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 317 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
315 | tr("%1 exists. Ok to overwrite?").arg( item ), | 318 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), |
316 | tr("Yes"),tr("No"),0,0,1) ) { | 319 | tr("Yes"),tr("No"),0,0,1)) { |
317 | case 1: | 320 | case 1: |
318 | return; | 321 | return; |
319 | break; | 322 | break; |
320 | }; | 323 | }; |
321 | } | 324 | } |
322 | f.remove(); | 325 | f.remove(); |
323 | } | 326 | } |
324 | 327 | ||
325 | if( !copyFile( curFile, destFile) ) { | 328 | if( !copyFile( curFile, destFile) ) { |
326 | QMessageBox::message("AdvancedFm", | 329 | QMessageBox::message("AdvancedFm", |
327 | tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); | 330 | tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
328 | return; | 331 | return; |
329 | } | 332 | } |
330 | } | 333 | } |
331 | setOtherTabCurrent(); | 334 | rePopulate(); |
332 | rePopulate(); | ||
333 | } | 335 | } |
334 | } | 336 | } |
335 | 337 | ||
338 | void AdvancedFm::copyAsTimer() { | ||
339 | QTimer::singleShot(125,this,SLOT(copyAs())); | ||
340 | } | ||
341 | |||
336 | void AdvancedFm::copyAs() { | 342 | void AdvancedFm::copyAs() { |
337 | 343 | ||
338 | QStringList curFileList = getPath(); | 344 | QStringList curFileList = getPath(); |
339 | QString curFile, item; | 345 | QString curFile, item; |
340 | InputDialog *fileDlg; | 346 | InputDialog *fileDlg; |
341 | 347 | ||
342 | QDir *thisDir = CurrentDir(); | 348 | QDir *thisDir = CurrentDir(); |
343 | QDir *thatDir = OtherDir(); | 349 | QDir *thatDir = OtherDir(); |
344 | 350 | ||
345 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 351 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
346 | QString destFile; | 352 | QString destFile; |
347 | item=(*it); | 353 | item=(*it); |
348 | curFile = thisDir->canonicalPath()+"/"+(*it); | 354 | curFile = thisDir->canonicalPath()+"/"+(*it); |
349 | fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); | 355 | fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0); |
350 | 356 | ||
351 | fileDlg->setInputText((const QString &) destFile ); | 357 | fileDlg->setInputText((const QString &) destFile ); |
352 | fileDlg->exec(); | 358 | fileDlg->exec(); |
353 | 359 | ||
354 | if( fileDlg->result() == 1 ) { | 360 | if( fileDlg->result() == 1 ) { |
355 | QString filename = fileDlg->LineEdit1->text(); | 361 | QString filename = fileDlg->LineEdit1->text(); |
356 | destFile = thatDir->canonicalPath()+"/"+filename; | 362 | destFile = thatDir->canonicalPath()+"/"+filename; |
357 | 363 | ||
358 | QFile f( destFile); | 364 | QFile f( destFile); |
359 | if( f.exists()) { | 365 | if( f.exists()) { |
360 | switch (QMessageBox::warning(this,tr("File Exists!"), | 366 | switch (QMessageBox::warning(this,tr("File Exists!"), |
361 | item+tr("\nexists. Ok to overwrite?"), | 367 | tr("<P> %1 already exists. Ok to overwrite?</p>").arg(item), |
362 | tr("Yes"),tr("No"),0,0,1) ) { | 368 | tr("Yes"),tr("No"),0,0,1) ) { |
363 | case 0: | 369 | case 0: |
364 | f.remove(); | 370 | f.remove(); |
365 | break; | 371 | break; |
366 | case 1: | 372 | case 1: |
367 | return; | 373 | return; |
368 | break; | 374 | break; |
369 | }; | 375 | }; |
370 | } | 376 | } |
371 | if( !copyFile( curFile, destFile) ) { | 377 | if( !copyFile( curFile, destFile) ) { |
372 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 378 | QMessageBox::message("AdvancedFm",tr("<p>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
373 | +curFile +tr("to\n")+destFile); | ||
374 | return; | 379 | return; |
375 | } | 380 | } |
376 | } | 381 | } |
377 | delete fileDlg; | 382 | delete fileDlg; |
378 | 383 | ||
379 | } | 384 | } |
380 | rePopulate(); | 385 | rePopulate(); |
381 | setOtherTabCurrent(); | 386 | // setOtherTabCurrent(); |
382 | qApp->processEvents(); | 387 | qApp->processEvents(); |
383 | 388 | ||
384 | } | 389 | } |
385 | 390 | ||
391 | void AdvancedFm::copySameDirTimer() { | ||
392 | QTimer::singleShot(125,this,SLOT(copySameDir())); | ||
393 | } | ||
394 | |||
386 | void AdvancedFm::copySameDir() { | 395 | void AdvancedFm::copySameDir() { |
387 | qApp->processEvents(); | 396 | qApp->processEvents(); |
388 | QStringList curFileList = getPath(); | 397 | QStringList curFileList = getPath(); |
389 | QString curFile, item, destFile; | 398 | QString curFile, item, destFile; |
390 | InputDialog *fileDlg; | 399 | InputDialog *fileDlg; |
391 | 400 | ||
392 | QDir *thisDir = CurrentDir(); | 401 | QDir *thisDir = CurrentDir(); |
393 | 402 | ||
@@ -402,42 +411,44 @@ void AdvancedFm::copySameDir() { | |||
402 | if( fileDlg->result() == 1 ) { | 411 | if( fileDlg->result() == 1 ) { |
403 | 412 | ||
404 | QString filename = fileDlg->LineEdit1->text(); | 413 | QString filename = fileDlg->LineEdit1->text(); |
405 | destFile = thisDir->canonicalPath()+"/"+filename; | 414 | destFile = thisDir->canonicalPath()+"/"+filename; |
406 | 415 | ||
407 | QFile f(destFile); | 416 | QFile f(destFile); |
408 | if( f.exists()) { | 417 | if( f.exists()) { |
409 | switch (QMessageBox::warning(this,tr("Delete"), | 418 | switch (QMessageBox::warning(this,tr("Delete"), |
410 | destFile+tr(" already exists.\nDo you really want to delete it?"), | 419 | tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile), |
411 | tr("Yes"),tr("No"),0,0,1) ) { | 420 | tr("Yes"),tr("No"),0,0,1) ) { |
412 | case 0: | 421 | case 0: |
413 | 422 | ||
414 | f.remove(); | 423 | f.remove(); |
415 | break; | 424 | break; |
416 | case 1: | 425 | case 1: |
417 | return; | 426 | return; |
418 | break; | 427 | break; |
419 | }; | 428 | }; |
420 | } | 429 | } |
421 | if(!copyFile( curFile,destFile) ) { | 430 | if(!copyFile( curFile,destFile) ) { |
422 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 431 | QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
423 | +curFile +tr("to\n")+destFile); | ||
424 | return; | 432 | return; |
425 | } | 433 | } |
426 | 434 | ||
427 | // odebug << "copy "+curFile+" as "+destFile << oendl; | 435 | // odebug << "copy "+curFile+" as "+destFile << oendl; |
428 | } | 436 | } |
429 | delete fileDlg; | 437 | delete fileDlg; |
430 | } | 438 | } |
431 | rePopulate(); | 439 | rePopulate(); |
432 | } | 440 | } |
433 | 441 | ||
442 | void AdvancedFm::moveTimer() { | ||
443 | QTimer::singleShot(125,this,SLOT(move())); | ||
444 | } | ||
445 | |||
434 | void AdvancedFm::move() { | 446 | void AdvancedFm::move() { |
435 | qApp->processEvents(); | ||
436 | 447 | ||
437 | QStringList curFileList = getPath(); | 448 | QStringList curFileList = getPath(); |
438 | if( curFileList.count() > 0) { | 449 | if( curFileList.count() > 0) { |
439 | QString curFile, destFile, item; | 450 | QString curFile, destFile, item; |
440 | 451 | ||
441 | QDir *thisDir = CurrentDir(); | 452 | QDir *thisDir = CurrentDir(); |
442 | QDir *thatDir = OtherDir(); | 453 | QDir *thatDir = OtherDir(); |
443 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 454 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
@@ -455,30 +466,29 @@ void AdvancedFm::move() { | |||
455 | curFile+= item; | 466 | curFile+= item; |
456 | // odebug << "CurrentFile file is " + curFile << oendl; | 467 | // odebug << "CurrentFile file is " + curFile << oendl; |
457 | 468 | ||
458 | if(QFileInfo(curFile).isDir()) { | 469 | if(QFileInfo(curFile).isDir()) { |
459 | moveDirectory( curFile, destFile ); | 470 | moveDirectory( curFile, destFile ); |
460 | rePopulate(); | 471 | rePopulate(); |
461 | return; | 472 | return; |
462 | } | 473 | } |
463 | 474 | QFile f( curFile); | |
464 | QFile f( curFile); | ||
465 | if( f.exists()) { | 475 | if( f.exists()) { |
466 | if( !copyFile( curFile, destFile) ) { | 476 | if( !copyFile( curFile, destFile) ) { |
467 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 477 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
468 | return; | 478 | return; |
469 | } else | 479 | } else |
470 | QFile::remove(curFile); | 480 | QFile::remove(curFile); |
471 | } | 481 | } |
472 | } | 482 | } |
473 | 483 | ||
474 | } | 484 | } |
475 | rePopulate(); | 485 | rePopulate(); |
476 | setOtherTabCurrent(); | 486 | //setOtherTabCurrent(); |
477 | } | 487 | } |
478 | 488 | ||
479 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 489 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
480 | int err = 0; | 490 | int err = 0; |
481 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; | 491 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; |
482 | err = system((const char*)cmd); | 492 | err = system((const char*)cmd); |
483 | } else | 493 | } else |
484 | err = -1; | 494 | err = -1; |
@@ -501,77 +511,75 @@ bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | |||
501 | return false; | 511 | return false; |
502 | } | 512 | } |
503 | 513 | ||
504 | return true; | 514 | return true; |
505 | } | 515 | } |
506 | 516 | ||
507 | 517 | ||
508 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 518 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
509 | 519 | if(QFileInfo(src).isDir()) { | |
510 | 520 | if( copyDirectory( src, dest )) { | |
511 | if(QFileInfo(src).isDir()) { | 521 | // setOtherTabCurrent(); |
512 | if( copyDirectory( src, dest )) { | 522 | rePopulate(); |
513 | setOtherTabCurrent(); | 523 | return true; |
514 | populateView(); | 524 | } |
515 | return true; | 525 | else |
516 | } | 526 | return false; |
517 | else | 527 | } |
518 | return false; | 528 | |
519 | } | 529 | |
520 | 530 | bool success = true; | |
521 | 531 | struct stat status; | |
522 | bool success = true; | 532 | QFile srcFile(src); |
523 | struct stat status; | 533 | QFile destFile(dest); |
524 | QFile srcFile(src); | 534 | int err=0; |
525 | QFile destFile(dest); | 535 | int read_fd=0; |
526 | int err=0; | 536 | int write_fd=0; |
527 | int read_fd=0; | 537 | struct stat stat_buf; |
528 | int write_fd=0; | 538 | off_t offset = 0; |
529 | struct stat stat_buf; | 539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
530 | off_t offset = 0; | ||
531 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | ||
532 | // owarn << "open failed" << oendl; | 540 | // owarn << "open failed" << oendl; |
533 | return success = false; | 541 | return success = false; |
534 | } | 542 | } |
535 | read_fd = srcFile.handle(); | 543 | read_fd = srcFile.handle(); |
536 | if(read_fd != -1) { | 544 | if(read_fd != -1) { |
537 | fstat (read_fd, &stat_buf); | 545 | fstat (read_fd, &stat_buf); |
538 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
539 | // owarn << "destfile open failed" << oendl; | 547 | // owarn << "destfile open failed" << oendl; |
540 | return success = false; | 548 | return success = false; |
541 | } | 549 | } |
542 | write_fd = destFile.handle(); | 550 | write_fd = destFile.handle(); |
543 | if(write_fd != -1) { | 551 | if(write_fd != -1) { |
544 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 552 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
545 | if( err == -1) { | 553 | if( err == -1) { |
546 | QString msg; | 554 | QString msg; |
547 | switch(err) { | 555 | switch(err) { |
548 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 556 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
549 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 557 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
550 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 558 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
551 | case EIO: msg = "Unspecified error while reading from in_fd."; | 559 | case EIO: msg = "Unspecified error while reading from in_fd."; |
552 | }; | 560 | }; |
553 | success = false; | 561 | success = false; |
554 | // owarn << msg << oendl; | 562 | // owarn << msg << oendl; |
555 | } | 563 | } |
556 | } else { | 564 | } else { |
557 | success = false; | 565 | success = false; |
558 | } | 566 | } |
559 | } else { | 567 | } else { |
560 | success = false; | 568 | success = false; |
561 | } | 569 | } |
562 | srcFile.close(); | 570 | srcFile.close(); |
563 | destFile.close(); | 571 | destFile.close(); |
564 | // Set file permissions | 572 | // Set file permissions |
565 | if( stat( QFile::encodeName(src), &status ) == 0 ) { | 573 | if( stat( QFile::encodeName(src), &status ) == 0 ) { |
566 | chmod( QFile::encodeName(dest), status.st_mode ); | 574 | chmod( QFile::encodeName(dest), status.st_mode ); |
567 | } | 575 | } |
568 | 576 | ||
569 | return success; | 577 | return success; |
570 | } | 578 | } |
571 | 579 | ||
572 | void AdvancedFm::runCommand() { | 580 | void AdvancedFm::runCommand() { |
573 | if( !CurrentView()->currentItem()) return; | 581 | if( !CurrentView()->currentItem()) return; |
574 | QDir *thisDir = CurrentDir(); | 582 | QDir *thisDir = CurrentDir(); |
575 | 583 | ||
576 | QString curFile; | 584 | QString curFile; |
577 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); | 585 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); |
@@ -703,21 +711,19 @@ void AdvancedFm::selectAll() { | |||
703 | thisView->selectAll(true); | 711 | thisView->selectAll(true); |
704 | thisView->setSelected( thisView->firstChild(),false); | 712 | thisView->setSelected( thisView->firstChild(),false); |
705 | } | 713 | } |
706 | 714 | ||
707 | void AdvancedFm::startProcess(const QString & cmd) { | 715 | void AdvancedFm::startProcess(const QString & cmd) { |
708 | QStringList command; | 716 | QStringList command; |
709 | OProcess *process; | 717 | OProcess *process; |
710 | process = new OProcess(); | 718 | process = new OProcess(); |
711 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | 719 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); |
712 | this, SLOT( processEnded(Opie::Core::OProcess*))); | ||
713 | 720 | ||
714 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | 721 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
715 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | ||
716 | 722 | ||
717 | command << "/bin/sh"; | 723 | command << "/bin/sh"; |
718 | command << "-c"; | 724 | command << "-c"; |
719 | command << cmd.latin1(); | 725 | command << cmd.latin1(); |
720 | *process << command; | 726 | *process << command; |
721 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 727 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
722 | odebug << "could not start process" << oendl; | 728 | odebug << "could not start process" << oendl; |
723 | } | 729 | } |
@@ -749,23 +755,23 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
749 | } | 755 | } |
750 | else if ( e->type() == QEvent::FocusOut ) { | 756 | else if ( e->type() == QEvent::FocusOut ) { |
751 | cancelRename(); | 757 | cancelRename(); |
752 | return true; | 758 | return true; |
753 | } | 759 | } |
754 | } | 760 | } |
755 | if ( o->inherits( "QListView" ) ) { | 761 | if ( o->inherits( "QListView" ) ) { |
756 | if ( e->type() == QEvent::FocusIn ) { | 762 | if ( e->type() == QEvent::FocusIn ) { |
757 | if( o == Local_View) { //keep track of which view | 763 | // if( o == Local_View) { //keep track of which view |
758 | qDebug("local view"); | 764 | // qDebug("local view"); |
759 | whichTab = 1; | 765 | // whichTab = 1; |
760 | } else { | 766 | // } else { |
761 | whichTab = 2; | 767 | // whichTab = 2; |
762 | qDebug("remote view"); | 768 | // qDebug("remote view"); |
763 | } | 769 | // } |
764 | } | 770 | } |
765 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 771 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
766 | } | 772 | } |
767 | 773 | ||
768 | return QWidget::eventFilter( o, e ); | 774 | return QWidget::eventFilter( o, e ); |
769 | } | 775 | } |
770 | 776 | ||
771 | 777 | ||
@@ -784,35 +790,28 @@ void AdvancedFm::cancelRename() { | |||
784 | } | 790 | } |
785 | 791 | ||
786 | void AdvancedFm::doRename(QListView * view) { | 792 | void AdvancedFm::doRename(QListView * view) { |
787 | if( !CurrentView()->currentItem()) return; | 793 | if( !CurrentView()->currentItem()) return; |
788 | 794 | ||
789 | QRect r = view->itemRect( view->currentItem( )); | 795 | QRect r = view->itemRect( view->currentItem( )); |
790 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 796 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
791 | r.setX( view->contentsX() ); | 797 | r.setX( view->contentsX() ); |
792 | 798 | if ( r.width() > view->visibleWidth() ) | |
793 | if ( r.width() > view->visibleWidth() ) | ||
794 | r.setWidth( view->visibleWidth() ); | 799 | r.setWidth( view->visibleWidth() ); |
795 | 800 | ||
796 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 801 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
797 | renameBox->setFrame(true); | 802 | renameBox->setFrame(true); |
798 | |||
799 | renameBox->setText( view->currentItem()->text(0) ); | 803 | renameBox->setText( view->currentItem()->text(0) ); |
800 | |||
801 | renameBox->selectAll(); | 804 | renameBox->selectAll(); |
802 | renameBox->installEventFilter( this ); | 805 | renameBox->installEventFilter( this ); |
803 | |||
804 | view->addChild( renameBox, r.x(), r.y() ); | 806 | view->addChild( renameBox, r.x(), r.y() ); |
805 | 807 | renameBox->resize( r.size() ); | |
806 | renameBox->resize( r.size() ); | 808 | view->viewport()->setFocusProxy( renameBox ); |
807 | 809 | renameBox->setFocus(); | |
808 | view->viewport()->setFocusProxy( renameBox ); | ||
809 | |||
810 | renameBox->setFocus(); | ||
811 | renameBox->show(); | 810 | renameBox->show(); |
812 | } | 811 | } |
813 | 812 | ||
814 | 813 | ||
815 | void AdvancedFm::renameIt() { | 814 | void AdvancedFm::renameIt() { |
816 | if( !CurrentView()->currentItem()) return; | 815 | if( !CurrentView()->currentItem()) return; |
817 | 816 | ||
818 | QListView *thisView = CurrentView(); | 817 | QListView *thisView = CurrentView(); |