-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 14 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 109 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 12 |
3 files changed, 109 insertions, 26 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 41e800c..acd50c2 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -168,68 +168,76 @@ void fileBrowser::populateList() | |||
168 | currentDir.setMatchAllDirs(TRUE); | 168 | currentDir.setMatchAllDirs(TRUE); |
169 | 169 | ||
170 | currentDir.setNameFilter(filterStr); | 170 | currentDir.setNameFilter(filterStr); |
171 | // currentDir.setNameFilter("*.txt;*.etx"); | 171 | // currentDir.setNameFilter("*.txt;*.etx"); |
172 | QString fileL, fileS, fileDate; | 172 | QString fileL, fileS, fileDate; |
173 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 173 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
174 | QFileInfoListIterator it(*list); | 174 | QFileInfoListIterator it(*list); |
175 | QFileInfo *fi; | 175 | QFileInfo *fi; |
176 | while ( (fi=it.current()) ) { | 176 | while ( (fi=it.current()) ) { |
177 | 177 | ||
178 | if (fi->isSymLink() ){ | 178 | if (fi->isSymLink() ){ |
179 | QString symLink=fi->readLink(); | 179 | QString symLink=fi->readLink(); |
180 | // qDebug("Symlink detected "+symLink); | 180 | // qDebug("Symlink detected "+symLink); |
181 | QFileInfo sym( symLink); | 181 | QFileInfo sym( symLink); |
182 | fileS.sprintf( "%10li", sym.size() ); | 182 | fileS.sprintf( "%10li", sym.size() ); |
183 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 183 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
184 | fileDate = sym.lastModified().toString(); | 184 | fileDate = sym.lastModified().toString(); |
185 | } else { | 185 | } else { |
186 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 186 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
187 | fileS.sprintf( "%10li", fi->size() ); | 187 | fileS.sprintf( "%10li", fi->size() ); |
188 | fileL.sprintf( "%s",fi->fileName().data() ); | 188 | fileL.sprintf( "%s",fi->fileName().data() ); |
189 | fileDate= fi->lastModified().toString(); | 189 | fileDate= fi->lastModified().toString(); |
190 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 190 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
191 | fileL+="/"; | 191 | fileL+="/"; |
192 | isDir=TRUE; | 192 | isDir=TRUE; |
193 | // qDebug( fileL); | 193 | // qDebug( fileL); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | if(fileL !="./") { | 196 | if(fileL !="./") { |
197 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 197 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
198 | QPixmap pm; | 198 | QPixmap pm; |
199 | pm= Resource::loadPixmap( "folder" ); | 199 | pm= Resource::loadPixmap( "folder" ); |
200 | if(isDir || fileL.find("/",0,TRUE) != -1) | 200 | |
201 | if(isDir || fileL.find("/",0,TRUE) != -1) { | ||
202 | if( !QDir( fi->filePath() ).isReadable()) | ||
203 | pm = Resource::loadPixmap( "lockedfolder" ); | ||
201 | item->setPixmap( 0,pm ); | 204 | item->setPixmap( 0,pm ); |
202 | else | 205 | } else { |
203 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 206 | if( !fi->isReadable() ) |
207 | pm = Resource::loadPixmap( "locked" ); | ||
208 | else | ||
209 | pm = Resource::loadPixmap( "fileopen" ); | ||
210 | item->setPixmap( 0,pm); | ||
211 | } | ||
204 | if( fileL.find("->",0,TRUE) != -1) { | 212 | if( fileL.find("->",0,TRUE) != -1) { |
205 | // overlay link image | 213 | // overlay link image |
206 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 214 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
207 | QPainter painter( &pm ); | 215 | QPainter painter( &pm ); |
208 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 216 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
209 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 217 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
210 | item->setPixmap( 0, pm); | 218 | item->setPixmap( 0, pm); |
211 | } | 219 | } |
212 | } | 220 | } |
213 | isDir=FALSE; | 221 | isDir=FALSE; |
214 | ++it; | 222 | ++it; |
215 | } | 223 | } |
216 | ListView->setSorting( 3, FALSE); | 224 | ListView->setSorting( 3, FALSE); |
217 | QString currentPath = currentDir.canonicalPath(); | 225 | QString currentPath = currentDir.canonicalPath(); |
218 | 226 | ||
219 | fillCombo( (const QString &)currentPath); | 227 | fillCombo( (const QString &)currentPath); |
220 | // dirPathCombo->lineEdit()->setText(currentPath); | 228 | // dirPathCombo->lineEdit()->setText(currentPath); |
221 | 229 | ||
222 | // if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 230 | // if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
223 | // dirPathCombo->clear(); | 231 | // dirPathCombo->clear(); |
224 | // dirPathStringList.prepend(currentPath ); | 232 | // dirPathStringList.prepend(currentPath ); |
225 | // dirPathCombo->insertStringList( dirPathStringList,-1); | 233 | // dirPathCombo->insertStringList( dirPathStringList,-1); |
226 | // } | 234 | // } |
227 | } | 235 | } |
228 | 236 | ||
229 | void fileBrowser::upDir() | 237 | void fileBrowser::upDir() |
230 | { | 238 | { |
231 | QString current = currentDir.canonicalPath(); | 239 | QString current = currentDir.canonicalPath(); |
232 | QDir dir(current); | 240 | QDir dir(current); |
233 | dir.cdUp(); | 241 | dir.cdUp(); |
234 | current = dir.canonicalPath(); | 242 | current = dir.canonicalPath(); |
235 | chdir( current.latin1() ); | 243 | chdir( current.latin1() ); |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e97a9bf..37e2134 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,56 +1,57 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.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 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | #include "ftplib.h" | 15 | #include "ftplib.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | 24 | ||
25 | #include <qstringlist.h> | ||
25 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
26 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
27 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
28 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
29 | #include <qdir.h> | 30 | #include <qdir.h> |
30 | #include <qfile.h> | 31 | #include <qfile.h> |
31 | #include <qstring.h> | 32 | #include <qstring.h> |
32 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
33 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
34 | #include <qlistview.h> | 35 | #include <qlistview.h> |
35 | #include <qmainwindow.h> | 36 | #include <qmainwindow.h> |
36 | #include <qlabel.h> | 37 | #include <qlabel.h> |
37 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
38 | #include <qspinbox.h> | 39 | #include <qspinbox.h> |
39 | #include <qtabwidget.h> | 40 | #include <qtabwidget.h> |
40 | #include <qwidget.h> | 41 | #include <qwidget.h> |
41 | #include <qlayout.h> | 42 | #include <qlayout.h> |
42 | #include <qimage.h> | 43 | #include <qimage.h> |
43 | #include <qpixmap.h> | 44 | #include <qpixmap.h> |
44 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
45 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
46 | #include <qregexp.h> | 47 | #include <qregexp.h> |
47 | 48 | ||
48 | #include <unistd.h> | 49 | #include <unistd.h> |
49 | #include <stdlib.h> | 50 | #include <stdlib.h> |
50 | 51 | ||
51 | 52 | ||
52 | QProgressBar *ProgressBar; | 53 | QProgressBar *ProgressBar; |
53 | static netbuf *conn=NULL; | 54 | static netbuf *conn=NULL; |
54 | 55 | ||
55 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 56 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
56 | { | 57 | { |
@@ -207,122 +208,128 @@ OpieFtp::OpieFtp( ) | |||
207 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 208 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
208 | TextLabel4->setText( tr( "Port" ) ); | 209 | TextLabel4->setText( tr( "Port" ) ); |
209 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 210 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
210 | 211 | ||
211 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 212 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
212 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 213 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
213 | PortSpinBox->setMaxValue(32786); | 214 | PortSpinBox->setMaxValue(32786); |
214 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 215 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
215 | 216 | ||
216 | QPushButton *deleteServerBtn; | 217 | QPushButton *deleteServerBtn; |
217 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); | 218 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); |
218 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | 219 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); |
219 | 220 | ||
220 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 221 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
221 | 222 | ||
222 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 223 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
223 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 224 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
224 | connectServerBtn->setToggleButton(TRUE); | 225 | connectServerBtn->setToggleButton(TRUE); |
225 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 226 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
226 | 227 | ||
227 | 228 | ||
228 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 229 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
229 | tabLayout_3->addItem( spacer, 5, 0 ); | 230 | tabLayout_3->addItem( spacer, 5, 0 ); |
230 | 231 | ||
231 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 232 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
232 | 233 | ||
233 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 234 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
234 | this,SLOT(tabChanged(QWidget*))); | 235 | this,SLOT(tabChanged(QWidget*))); |
235 | 236 | ||
236 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 237 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
237 | currentDir.setPath( QDir::currentDirPath()); | 238 | currentDir.setPath( QDir::currentDirPath()); |
238 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 239 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
239 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | ||
240 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); | ||
241 | 240 | ||
242 | currentPathEdit->setText( currentDir.canonicalPath()); | 241 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
243 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 242 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); |
243 | |||
244 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
245 | |||
246 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | ||
247 | this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) ); | ||
248 | |||
249 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | ||
250 | this,SLOT(currentPathComboChanged())); | ||
244 | 251 | ||
245 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 252 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
246 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 253 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
247 | 254 | ||
248 | // fillCombos(); | 255 | // fillCombos(); |
249 | 256 | ||
250 | #ifdef DEVELOPERS_VERSION | 257 | #ifdef DEVELOPERS_VERSION |
251 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 258 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); |
252 | UsernameComboBox->lineEdit()->setText("root"); | 259 | UsernameComboBox->lineEdit()->setText("root"); |
253 | PortSpinBox->setValue( 4242); | 260 | PortSpinBox->setValue( 4242); |
254 | remotePath->setText( currentRemoteDir = "/"); | 261 | remotePath->setText( currentRemoteDir = "/"); |
255 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 262 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
256 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | 263 | // UsernameComboBox->lineEdit()->setText("llornkcor"); |
257 | // PortSpinBox->setValue( 21); | 264 | // PortSpinBox->setValue( 21); |
258 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); | 265 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); |
259 | PasswordEdit->setText( tr( "" ) ); | 266 | PasswordEdit->setText( tr( "" ) ); |
260 | #endif | 267 | #endif |
261 | filterStr="*"; | 268 | filterStr="*"; |
262 | b=FALSE; | 269 | b=FALSE; |
263 | populateLocalView(); | 270 | populateLocalView(); |
264 | readConfig(); | 271 | readConfig(); |
265 | ServerComboBox->setCurrentItem(currentServerConfig); | 272 | ServerComboBox->setCurrentItem(currentServerConfig); |
266 | TabWidget->setCurrentPage(2); | 273 | TabWidget->setCurrentPage(2); |
267 | } | 274 | } |
268 | 275 | ||
269 | OpieFtp::~OpieFtp() | 276 | OpieFtp::~OpieFtp() |
270 | { | 277 | { |
271 | } | 278 | } |
272 | 279 | ||
273 | void OpieFtp::cleanUp() | 280 | void OpieFtp::cleanUp() |
274 | { | 281 | { |
275 | if(conn) | 282 | if(conn) |
276 | FtpQuit(conn); | 283 | FtpQuit(conn); |
277 | QString sfile=QDir::homeDirPath(); | 284 | QString sfile=QDir::homeDirPath(); |
278 | if(sfile.right(1) != "/") | 285 | if(sfile.right(1) != "/") |
279 | sfile+="/._temp"; | 286 | sfile+="/._temp"; |
280 | else | 287 | else |
281 | sfile+="._temp"; | 288 | sfile+="._temp"; |
282 | QFile file( sfile); | 289 | QFile file( sfile); |
283 | if(file.exists()) | 290 | if(file.exists()) |
284 | file.remove(); | 291 | file.remove(); |
285 | } | 292 | } |
286 | 293 | ||
287 | void OpieFtp::tabChanged(QWidget *w) | 294 | void OpieFtp::tabChanged(QWidget *w) |
288 | { | 295 | { |
289 | if (TabWidget->currentPageIndex() == 0) { | 296 | if (TabWidget->currentPageIndex() == 0) { |
290 | currentPathEdit->setText( currentDir.canonicalPath()); | 297 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
291 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 298 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
292 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 299 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
293 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 300 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
294 | } | 301 | } |
295 | if (TabWidget->currentPageIndex() == 1) { | 302 | if (TabWidget->currentPageIndex() == 1) { |
296 | currentPathEdit->setText( currentRemoteDir ); | 303 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
297 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 304 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
298 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 305 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
299 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 306 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
300 | } | 307 | } |
301 | if (TabWidget->currentPageIndex() == 2) { | 308 | if (TabWidget->currentPageIndex() == 2) { |
302 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 309 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
303 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 310 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
304 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 311 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
305 | } | 312 | } |
306 | } | 313 | } |
307 | 314 | ||
308 | void OpieFtp::newConnection() | 315 | void OpieFtp::newConnection() |
309 | { | 316 | { |
310 | UsernameComboBox->lineEdit()->setText(""); | 317 | UsernameComboBox->lineEdit()->setText(""); |
311 | PasswordEdit->setText( "" ); | 318 | PasswordEdit->setText( "" ); |
312 | ServerComboBox->lineEdit()->setText( ""); | 319 | ServerComboBox->lineEdit()->setText( ""); |
313 | remotePath->setText( currentRemoteDir = "/"); | 320 | remotePath->setText( currentRemoteDir = "/"); |
314 | PortSpinBox->setValue( 21); | 321 | PortSpinBox->setValue( 21); |
315 | TabWidget->setCurrentPage(2); | 322 | TabWidget->setCurrentPage(2); |
316 | currentServerConfig = -1; | 323 | currentServerConfig = -1; |
317 | } | 324 | } |
318 | 325 | ||
319 | void OpieFtp::serverComboEdited(const QString & edit) { | 326 | void OpieFtp::serverComboEdited(const QString & edit) { |
320 | if( !edit.isEmpty() ) { | 327 | if( !edit.isEmpty() ) { |
321 | currentServerConfig = -1; | 328 | currentServerConfig = -1; |
322 | qDebug("comboedited"); | 329 | qDebug("comboedited"); |
323 | } | 330 | } |
324 | } | 331 | } |
325 | 332 | ||
326 | void OpieFtp::connectorBtnToggled(bool On) | 333 | void OpieFtp::connectorBtnToggled(bool On) |
327 | { | 334 | { |
328 | if(On) { | 335 | if(On) { |
@@ -515,75 +522,95 @@ bool OpieFtp::remoteChDir(const QString &dir) | |||
515 | 522 | ||
516 | void OpieFtp::populateLocalView() | 523 | void OpieFtp::populateLocalView() |
517 | { | 524 | { |
518 | Local_View->clear(); | 525 | Local_View->clear(); |
519 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 526 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
520 | currentDir.setMatchAllDirs(TRUE); | 527 | currentDir.setMatchAllDirs(TRUE); |
521 | currentDir.setNameFilter(filterStr); | 528 | currentDir.setNameFilter(filterStr); |
522 | QString fileL, fileS, fileDate; | 529 | QString fileL, fileS, fileDate; |
523 | bool isDir=FALSE; | 530 | bool isDir=FALSE; |
524 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 531 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
525 | QFileInfoListIterator it(*list); | 532 | QFileInfoListIterator it(*list); |
526 | QFileInfo *fi; | 533 | QFileInfo *fi; |
527 | while ( (fi=it.current()) ) { | 534 | while ( (fi=it.current()) ) { |
528 | if (fi->isSymLink() ){ | 535 | if (fi->isSymLink() ){ |
529 | QString symLink=fi->readLink(); | 536 | QString symLink=fi->readLink(); |
530 | // qDebug("Symlink detected "+symLink); | 537 | // qDebug("Symlink detected "+symLink); |
531 | QFileInfo sym( symLink); | 538 | QFileInfo sym( symLink); |
532 | fileS.sprintf( "%10li", sym.size() ); | 539 | fileS.sprintf( "%10li", sym.size() ); |
533 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 540 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
534 | fileDate = sym.lastModified().toString(); | 541 | fileDate = sym.lastModified().toString(); |
535 | } else { | 542 | } else { |
536 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 543 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
537 | fileS.sprintf( "%10li", fi->size() ); | 544 | fileS.sprintf( "%10li", fi->size() ); |
538 | fileL.sprintf( "%s",fi->fileName().data() ); | 545 | fileL.sprintf( "%s",fi->fileName().data() ); |
539 | fileDate= fi->lastModified().toString(); | 546 | fileDate= fi->lastModified().toString(); |
540 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 547 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
541 | fileL+="/"; | 548 | fileL+="/"; |
542 | isDir=TRUE; | 549 | isDir=TRUE; |
543 | // qDebug( fileL); | 550 | // qDebug( fileL); |
544 | } | 551 | } |
545 | } | 552 | } |
546 | if(fileL !="./") { | 553 | if(fileL !="./") { |
547 | item = new QListViewItem( Local_View,fileL,fileS, fileDate); | 554 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
548 | if(isDir || fileL.find("/",0,TRUE) != -1) | 555 | QPixmap pm; |
549 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 556 | pm= Resource::loadPixmap( "folder" ); |
550 | else | 557 | |
551 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 558 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
559 | if( !QDir( fi->filePath() ).isReadable()) | ||
560 | pm = Resource::loadPixmap( "lockedfolder" ); | ||
561 | item->setPixmap( 0,pm ); | ||
562 | } else { | ||
563 | if( !fi->isReadable() ) | ||
564 | pm = Resource::loadPixmap( "locked" ); | ||
565 | else | ||
566 | pm = Resource::loadPixmap( "fileopen" ); | ||
567 | item->setPixmap( 0,pm); | ||
568 | } | ||
569 | if( fileL.find("->",0,TRUE) != -1) { | ||
570 | // overlay link image | ||
571 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | ||
572 | QPainter painter( &pm ); | ||
573 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
574 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
575 | item->setPixmap( 0, pm); | ||
576 | } | ||
552 | } | 577 | } |
553 | isDir=FALSE; | 578 | isDir=FALSE; |
554 | ++it; | 579 | ++it; |
555 | } | 580 | } |
556 | Local_View->setSorting( 3,FALSE); | 581 | Local_View->setSorting( 3,FALSE); |
557 | currentPathEdit->setText( currentDir.canonicalPath() ); | 582 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
583 | fillCombo( (const QString &)currentDir); | ||
584 | |||
558 | } | 585 | } |
559 | 586 | ||
560 | bool OpieFtp::populateRemoteView( ) | 587 | bool OpieFtp::populateRemoteView( ) |
561 | { | 588 | { |
562 | // qDebug("populate remoteview"); | 589 | // qDebug("populate remoteview"); |
563 | QString sfile=QDir::homeDirPath(); | 590 | QString sfile=QDir::homeDirPath(); |
564 | if(sfile.right(1) != "/") | 591 | if(sfile.right(1) != "/") |
565 | sfile+="/._temp"; | 592 | sfile+="/._temp"; |
566 | else | 593 | else |
567 | sfile+="._temp"; | 594 | sfile+="._temp"; |
568 | QFile file( sfile); | 595 | QFile file( sfile); |
569 | Remote_View->clear(); | 596 | Remote_View->clear(); |
570 | QString s, File_Name; | 597 | QString s, File_Name; |
571 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 598 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
572 | QString fileL, fileS, fileDate; | 599 | QString fileL, fileS, fileDate; |
573 | if ( file.open(IO_ReadOnly)) { | 600 | if ( file.open(IO_ReadOnly)) { |
574 | QTextStream t( &file ); // use a text stream | 601 | QTextStream t( &file ); // use a text stream |
575 | while ( !t.eof()) { | 602 | while ( !t.eof()) { |
576 | s = t.readLine(); | 603 | s = t.readLine(); |
577 | fileL = s.right(s.length()-55); | 604 | fileL = s.right(s.length()-55); |
578 | fileL = fileL.stripWhiteSpace(); | 605 | fileL = fileL.stripWhiteSpace(); |
579 | if(s.left(1) == "d") | 606 | if(s.left(1) == "d") |
580 | fileL = fileL+"/"; | 607 | fileL = fileL+"/"; |
581 | // fileL = "/"+fileL+"/"; | 608 | // fileL = "/"+fileL+"/"; |
582 | fileS = s.mid( 30, 42-30); | 609 | fileS = s.mid( 30, 42-30); |
583 | fileS = fileS.stripWhiteSpace(); | 610 | fileS = fileS.stripWhiteSpace(); |
584 | fileDate = s.mid( 42, 55-42); | 611 | fileDate = s.mid( 42, 55-42); |
585 | fileDate = fileDate.stripWhiteSpace(); | 612 | fileDate = fileDate.stripWhiteSpace(); |
586 | if(fileL.find("total",0,TRUE) == -1) { | 613 | if(fileL.find("total",0,TRUE) == -1) { |
587 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 614 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
588 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d"); | 615 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d"); |
589 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 616 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
@@ -632,65 +659,66 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
632 | msg.replace(QRegExp(":"),"\n"); | 659 | msg.replace(QRegExp(":"),"\n"); |
633 | QMessageBox::message(tr("Note"),msg); | 660 | QMessageBox::message(tr("Note"),msg); |
634 | qDebug(msg); | 661 | qDebug(msg); |
635 | } | 662 | } |
636 | currentRemoteDir=path; | 663 | currentRemoteDir=path; |
637 | } else { | 664 | } else { |
638 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 665 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
639 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 666 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
640 | strItem = strItem.stripWhiteSpace(); | 667 | strItem = strItem.stripWhiteSpace(); |
641 | currentRemoteDir = strItem; | 668 | currentRemoteDir = strItem; |
642 | if( !remoteChDir( (const QString &)strItem)) { | 669 | if( !remoteChDir( (const QString &)strItem)) { |
643 | currentRemoteDir = oldRemoteCurrentDir; | 670 | currentRemoteDir = oldRemoteCurrentDir; |
644 | strItem=""; | 671 | strItem=""; |
645 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 672 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
646 | } | 673 | } |
647 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 674 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
648 | qDebug("trying directory"); | 675 | qDebug("trying directory"); |
649 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 676 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
650 | currentRemoteDir = oldRemoteCurrentDir; | 677 | currentRemoteDir = oldRemoteCurrentDir; |
651 | strItem=""; | 678 | strItem=""; |
652 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 679 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
653 | 680 | ||
654 | } else { | 681 | } else { |
655 | currentRemoteDir = currentRemoteDir+strItem; | 682 | currentRemoteDir = currentRemoteDir+strItem; |
656 | } | 683 | } |
657 | } else { | 684 | } else { |
658 | qDebug("download "+strItem); | 685 | qDebug("download "+strItem); |
659 | } | 686 | } |
660 | } | 687 | } |
661 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 688 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
662 | if(currentRemoteDir.right(1) !="/") | 689 | if(currentRemoteDir.right(1) !="/") |
663 | currentRemoteDir +="/"; | 690 | currentRemoteDir +="/"; |
664 | currentPathEdit->setText( currentRemoteDir ); | 691 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
692 | fillRemoteCombo( (const QString &)currentDir); | ||
665 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 693 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
666 | } | 694 | } |
667 | 695 | ||
668 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 696 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
669 | { | 697 | { |
670 | QString strItem=selectedItem->text(0); | 698 | QString strItem=selectedItem->text(0); |
671 | QString strSize=selectedItem->text(1); | 699 | QString strSize=selectedItem->text(1); |
672 | strSize=strSize.stripWhiteSpace(); | 700 | strSize=strSize.stripWhiteSpace(); |
673 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 701 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
674 | // is symlink | 702 | // is symlink |
675 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 703 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
676 | if(QDir(strItem2).exists() ) { | 704 | if(QDir(strItem2).exists() ) { |
677 | currentDir.cd(strItem2, TRUE); | 705 | currentDir.cd(strItem2, TRUE); |
678 | populateLocalView(); | 706 | populateLocalView(); |
679 | } | 707 | } |
680 | } else { // not a symlink | 708 | } else { // not a symlink |
681 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 709 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
682 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 710 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
683 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 711 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
684 | currentDir.cd(strItem,FALSE); | 712 | currentDir.cd(strItem,FALSE); |
685 | populateLocalView(); | 713 | populateLocalView(); |
686 | } else { | 714 | } else { |
687 | currentDir.cdUp(); | 715 | currentDir.cdUp(); |
688 | populateLocalView(); | 716 | populateLocalView(); |
689 | } | 717 | } |
690 | if(QDir(strItem).exists()){ | 718 | if(QDir(strItem).exists()){ |
691 | currentDir.cd(strItem, TRUE); | 719 | currentDir.cd(strItem, TRUE); |
692 | populateLocalView(); | 720 | populateLocalView(); |
693 | } | 721 | } |
694 | } else { | 722 | } else { |
695 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 723 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
696 | if( QFile::exists(strItem ) ) { | 724 | if( QFile::exists(strItem ) ) { |
@@ -903,85 +931,126 @@ void OpieFtp::remoteRename() | |||
903 | fileDlg->exec(); | 931 | fileDlg->exec(); |
904 | if( fileDlg->result() == 1 ) { | 932 | if( fileDlg->result() == 1 ) { |
905 | QString oldName = currentRemoteDir +"/"+ curFile; | 933 | QString oldName = currentRemoteDir +"/"+ curFile; |
906 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 934 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
907 | QCopEnvelope ( "QPE/System", "busy()" ); | 935 | QCopEnvelope ( "QPE/System", "busy()" ); |
908 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 936 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
909 | QString msg; | 937 | QString msg; |
910 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 938 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
911 | msg.replace(QRegExp(":"),"\n"); | 939 | msg.replace(QRegExp(":"),"\n"); |
912 | QMessageBox::message(tr("Note"),msg); | 940 | QMessageBox::message(tr("Note"),msg); |
913 | } | 941 | } |
914 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 942 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
915 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 943 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
916 | } | 944 | } |
917 | } | 945 | } |
918 | 946 | ||
919 | void OpieFtp::localRename() | 947 | void OpieFtp::localRename() |
920 | { | 948 | { |
921 | QString curFile = Local_View->currentItem()->text(0); | 949 | QString curFile = Local_View->currentItem()->text(0); |
922 | InputDialog *fileDlg; | 950 | InputDialog *fileDlg; |
923 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 951 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
924 | fileDlg->inputText = curFile; | 952 | fileDlg->inputText = curFile; |
925 | fileDlg->exec(); | 953 | fileDlg->exec(); |
926 | if( fileDlg->result() == 1 ) { | 954 | if( fileDlg->result() == 1 ) { |
927 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 955 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
928 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 956 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
929 | if( rename(oldname.latin1(), newName.latin1())== -1) | 957 | if( rename(oldname.latin1(), newName.latin1())== -1) |
930 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 958 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
931 | } | 959 | } |
932 | populateLocalView(); | 960 | populateLocalView(); |
933 | } | 961 | } |
934 | 962 | ||
935 | void OpieFtp::currentPathEditChanged() | 963 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
964 | if (TabWidget->currentPageIndex() == 0) { | ||
965 | chdir( currentPath.latin1() ); | ||
966 | currentDir.cd( currentPath, TRUE); | ||
967 | populateLocalList(); | ||
968 | update(); | ||
969 | } else { | ||
970 | // chdir( currentPath.latin1() ); | ||
971 | // currentDir.cd( currentPath, TRUE); | ||
972 | // populateList(); | ||
973 | // update(); | ||
974 | |||
975 | } | ||
976 | } | ||
977 | |||
978 | void OpieFtp::fillCombo(const QString ¤tPath) { | ||
979 | |||
980 | currentPathComboBox->lineEdit()->setText(currentPath); | ||
981 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
982 | currentPathComboBox->clear(); | ||
983 | localDirPathStringList.prepend(currentPath ); | ||
984 | currentPathComboBox->insertStringList( localDirPathStringList,-1); | ||
985 | } | ||
986 | currentPathComboBox->lineEdit()->setText(currentPath); | ||
987 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
988 | currentPathComboBox->clear(); | ||
989 | remoteDirPathStringList.prepend(currentPath ); | ||
990 | currentPathComboBox->insertStringList( remoteDirPathStringList,-1); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | ||
995 | |||
996 | dirPathCombo->lineEdit()->setText(currentPath); | ||
997 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
998 | dirPathCombo->clear(); | ||
999 | remoteDirPathStringList.prepend(currentPath ); | ||
1000 | dirPathCombo->insertStringList( remoteDirPathStringList,-1); | ||
1001 | } | ||
1002 | } | ||
1003 | |||
1004 | void OpieFtp::currentPathComboChanged() | ||
936 | { | 1005 | { |
937 | QString oldRemoteCurrentDir = currentRemoteDir; | 1006 | QString oldRemoteCurrentDir = currentRemoteDir; |
938 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1007 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
939 | if (TabWidget->currentPageIndex() == 0) { | 1008 | if (TabWidget->currentPageIndex() == 0) { |
940 | if(QDir( currentPathEdit->text()).exists()) { | 1009 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
941 | currentDir.setPath( currentPathEdit->text() ); | 1010 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
942 | populateLocalView(); | 1011 | populateLocalView(); |
943 | } else { | 1012 | } else { |
944 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 1013 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
945 | } | 1014 | } |
946 | } | 1015 | } |
947 | if (TabWidget->currentPageIndex() == 1) { | 1016 | if (TabWidget->currentPageIndex() == 1) { |
948 | currentRemoteDir = currentPathEdit->text(); | 1017 | currentRemoteDir = currentPathCombo->lineEdit()->text(); |
949 | if(currentRemoteDir.right(1) !="/") { | 1018 | if(currentRemoteDir.right(1) !="/") { |
950 | currentRemoteDir = currentRemoteDir +"/"; | 1019 | currentRemoteDir = currentRemoteDir +"/"; |
951 | currentPathEdit->setText( currentRemoteDir ); | 1020 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
952 | } | 1021 | } |
953 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { | 1022 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
954 | currentRemoteDir = oldRemoteCurrentDir; | 1023 | currentRemoteDir = oldRemoteCurrentDir; |
955 | currentPathEdit->setText( currentRemoteDir ); | 1024 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
956 | } | 1025 | } |
957 | 1026 | ||
958 | remoteDirList( (const QString &)currentRemoteDir); | 1027 | remoteDirList( (const QString &)currentRemoteDir); |
959 | } | 1028 | } |
960 | } | 1029 | } |
961 | 1030 | ||
962 | void OpieFtp::switchToLocalTab() | 1031 | void OpieFtp::switchToLocalTab() |
963 | { | 1032 | { |
964 | TabWidget->setCurrentPage(0); | 1033 | TabWidget->setCurrentPage(0); |
965 | } | 1034 | } |
966 | 1035 | ||
967 | void OpieFtp::switchToRemoteTab() | 1036 | void OpieFtp::switchToRemoteTab() |
968 | { | 1037 | { |
969 | TabWidget->setCurrentPage(1); | 1038 | TabWidget->setCurrentPage(1); |
970 | } | 1039 | } |
971 | 1040 | ||
972 | void OpieFtp::switchToConfigTab() | 1041 | void OpieFtp::switchToConfigTab() |
973 | { | 1042 | { |
974 | TabWidget->setCurrentPage(2); | 1043 | TabWidget->setCurrentPage(2); |
975 | } | 1044 | } |
976 | 1045 | ||
977 | void OpieFtp::readConfig() | 1046 | void OpieFtp::readConfig() |
978 | { | 1047 | { |
979 | fillCombos(); | 1048 | fillCombos(); |
980 | Config cfg("opieftp"); | 1049 | Config cfg("opieftp"); |
981 | cfg.setGroup("Server"); | 1050 | cfg.setGroup("Server"); |
982 | currentServerConfig = cfg.readNumEntry("currentServer", -1); | 1051 | currentServerConfig = cfg.readNumEntry("currentServer", -1); |
983 | serverComboSelected( currentServerConfig); | 1052 | serverComboSelected( currentServerConfig); |
984 | } | 1053 | } |
985 | 1054 | ||
986 | void OpieFtp::writeConfig() | 1055 | void OpieFtp::writeConfig() |
987 | { | 1056 | { |
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 52ed885..57599b7 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -8,104 +8,110 @@ | |||
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 OPIEFTP_H | 12 | #ifndef OPIEFTP_H |
13 | #define OPIEFTP_H | 13 | #define OPIEFTP_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | 21 | ||
22 | class QVBoxLayout; | 22 | class QVBoxLayout; |
23 | class QHBoxLayout; | 23 | class QHBoxLayout; |
24 | class QGridLayout; | 24 | class QGridLayout; |
25 | class QComboBox; | 25 | class QComboBox; |
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListviewItem; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QProgressBar; | 29 | class QProgressBar; |
30 | class QSpinBox; | 30 | class QSpinBox; |
31 | class QTabWidget; | 31 | class QTabWidget; |
32 | class QWidget; | 32 | class QWidget; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | 39 | class QPushButton; |
40 | class QStringList; | ||
40 | 41 | ||
41 | class OpieFtp : public QMainWindow | 42 | class OpieFtp : public QMainWindow |
42 | { | 43 | { |
43 | Q_OBJECT | 44 | Q_OBJECT |
44 | 45 | ||
45 | public: | 46 | public: |
46 | OpieFtp( ); | 47 | OpieFtp( ); |
47 | ~OpieFtp(); | 48 | ~OpieFtp(); |
48 | 49 | ||
49 | QTabWidget *TabWidget; | 50 | QTabWidget *TabWidget; |
50 | QWidget *tab, *tab_2, *tab_3; | 51 | QWidget *tab, *tab_2, *tab_3; |
51 | QListView *Local_View, *Remote_View; | 52 | QListView *Local_View, *Remote_View; |
52 | 53 | ||
53 | QComboBox *UsernameComboBox, *ServerComboBox; | 54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
54 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; | 55 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; |
55 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
56 | QSpinBox* PortSpinBox; | 57 | QSpinBox* PortSpinBox; |
57 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; | 58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; |
58 | QDir currentDir; | 59 | QDir currentDir; |
59 | QString currentRemoteDir; | 60 | QString currentRemoteDir; |
60 | QString filterStr; | 61 | QString filterStr; |
61 | QListViewItem * item; | 62 | QListViewItem * item; |
62 | QPushButton *connectServerBtn; | 63 | QPushButton *connectServerBtn; |
63 | bool b; | 64 | bool b; |
64 | int currentServerConfig; | 65 | int currentServerConfig; |
65 | protected slots: | 66 | protected slots: |
66 | void serverComboEdited(const QString & ); | 67 | void serverComboEdited(const QString & ); |
67 | void showLocalMenu( QListViewItem *); | 68 | void showLocalMenu( QListViewItem *); |
68 | void showRemoteMenu( QListViewItem *); | 69 | void showRemoteMenu( QListViewItem *); |
69 | void doLocalCd(); | 70 | void doLocalCd(); |
70 | void doRemoteCd(); | 71 | void doRemoteCd(); |
71 | void localUpload(); | 72 | void localUpload(); |
72 | void remoteDownload(); | 73 | void remoteDownload(); |
73 | void newConnection(); | 74 | void newConnection(); |
74 | void connector(); | 75 | void connector(); |
75 | void disConnector(); | 76 | void disConnector(); |
76 | void populateLocalView(); | 77 | void populateLocalView(); |
77 | bool populateRemoteView(); | 78 | bool populateRemoteView(); |
78 | void showHidden(); | 79 | void showHidden(); |
79 | void writeConfig(); | 80 | void writeConfig(); |
80 | void readConfig(); | 81 | void readConfig(); |
81 | void localListClicked(QListViewItem *); | 82 | void localListClicked(QListViewItem *); |
82 | void remoteListClicked(QListViewItem *); | 83 | void remoteListClicked(QListViewItem *); |
83 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 84 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
84 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 85 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
85 | void localMakDir(); | 86 | void localMakDir(); |
86 | void localDelete(); | 87 | void localDelete(); |
87 | void remoteMakDir(); | 88 | void remoteMakDir(); |
88 | void remoteDelete(); | 89 | void remoteDelete(); |
89 | bool remoteDirList(const QString &); | 90 | bool remoteDirList(const QString &); |
90 | bool remoteChDir(const QString &); | 91 | bool remoteChDir(const QString &); |
91 | void tabChanged(QWidget*); | 92 | void tabChanged(QWidget*); |
92 | void cleanUp(); | 93 | void cleanUp(); |
93 | void remoteRename(); | 94 | void remoteRename(); |
94 | void localRename(); | 95 | void localRename(); |
95 | void currentPathEditChanged(); | 96 | void currentPathComboChanged(); |
97 | void fillCombos(); | ||
98 | void fillCombo(const QString &); | ||
99 | void currentPathComboActivated(const QString &); | ||
96 | void switchToLocalTab(); | 100 | void switchToLocalTab(); |
97 | void switchToRemoteTab(); | 101 | void switchToRemoteTab(); |
98 | void switchToConfigTab(); | 102 | void switchToConfigTab(); |
99 | void fillCombos(); | 103 | void fillCombo(); |
104 | void fillRemoteCombo(); | ||
100 | void serverComboSelected(int); | 105 | void serverComboSelected(int); |
101 | void deleteServer(); | 106 | void deleteServer(); |
102 | void connectorBtnToggled(bool); | 107 | void connectorBtnToggled(bool); |
103 | protected: | 108 | protected: |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | ||
104 | void nullifyCallBack(); | 110 | void nullifyCallBack(); |
105 | QGridLayout* tabLayout; | 111 | QGridLayout* tabLayout; |
106 | QGridLayout* tabLayout_2; | 112 | QGridLayout* tabLayout_2; |
107 | QGridLayout* tabLayout_3; | 113 | QGridLayout* tabLayout_3; |
108 | 114 | ||
109 | }; | 115 | }; |
110 | 116 | ||
111 | #endif // OPIEFTP_H | 117 | #endif // OPIEFTP_H |