author | llornkcor <llornkcor> | 2002-09-30 01:32:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-30 01:32:04 (UTC) |
commit | 251458a2dd6d75c59440dc006060db2544de5d0e (patch) (unidiff) | |
tree | e367bffa02a6e20caafa7f9917f1222fcaae0ab6 | |
parent | f6e9cebd79044b1ca54648ecdadd13db8c4673dc (diff) | |
download | opie-251458a2dd6d75c59440dc006060db2544de5d0e.zip opie-251458a2dd6d75c59440dc006060db2544de5d0e.tar.gz opie-251458a2dd6d75c59440dc006060db2544de5d0e.tar.bz2 |
fixed scroll, and cleanedup non used variables
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 9beac94..4e14946 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -55,20 +55,20 @@ extern "C" { | |||
55 | 55 | ||
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | 58 | ||
59 | 59 | ||
60 | QProgressBar *ProgressBar; | 60 | QProgressBar *ProgressBar; |
61 | static netbuf *conn=NULL; | 61 | static netbuf *conn=NULL; |
62 | 62 | ||
63 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 63 | static int log_progress(netbuf *, int xfered, void *) |
64 | { | 64 | { |
65 | int fsz = *(int *)arg; | 65 | // int fsz = *(int *)arg; |
66 | int pct = (xfered * 100) / fsz; | 66 | // int pct = (xfered * 100) / fsz; |
67 | // printf("%3d%%\r", pct); | 67 | // printf("%3d%%\r", pct); |
68 | // fflush(stdout); | 68 | // fflush(stdout); |
69 | ProgressBar->setProgress(xfered); | 69 | ProgressBar->setProgress(xfered); |
70 | qApp->processEvents(); | 70 | qApp->processEvents(); |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | 73 | ||
74 | OpieFtp::OpieFtp( ) | 74 | OpieFtp::OpieFtp( ) |
@@ -220,39 +220,42 @@ OpieFtp::OpieFtp( ) | |||
220 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 220 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
221 | TextLabel1->setText( tr( "Username" ) ); | 221 | TextLabel1->setText( tr( "Username" ) ); |
222 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 222 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
223 | 223 | ||
224 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 224 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
225 | UsernameComboBox->setEditable(TRUE); | 225 | UsernameComboBox->setEditable(TRUE); |
226 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 226 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
227 | 227 | ||
228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,SLOT( UsernameComboBoxEdited(const QString & ) )); | 228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, |
229 | SLOT( UsernameComboBoxEdited(const QString & ) )); | ||
229 | 230 | ||
230 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 231 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
231 | TextLabel2->setText( tr( "Password" ) ); | 232 | TextLabel2->setText( tr( "Password" ) ); |
232 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 233 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
233 | 234 | ||
234 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 235 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
235 | PasswordEdit->setEchoMode(QLineEdit::Password); | 236 | PasswordEdit->setEchoMode(QLineEdit::Password); |
236 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 237 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
237 | 238 | ||
238 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,SLOT( PasswordEditEdited(const QString & ) )); | 239 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, |
240 | SLOT( PasswordEditEdited(const QString & ) )); | ||
239 | 241 | ||
240 | //PasswordEdit->setFixedWidth(85); | 242 | //PasswordEdit->setFixedWidth(85); |
241 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 243 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
242 | TextLabel3->setText( tr( "Remote server" ) ); | 244 | TextLabel3->setText( tr( "Remote server" ) ); |
243 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 245 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
244 | 246 | ||
245 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 247 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
246 | ServerComboBox->setEditable(TRUE); | 248 | ServerComboBox->setEditable(TRUE); |
247 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 249 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
248 | 250 | ||
249 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 251 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
250 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 252 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, |
253 | SLOT(serverComboEdited(const QString & ) )); | ||
251 | 254 | ||
252 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 255 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
253 | TextLabel5->setText( tr( "Remote path" ) ); | 256 | TextLabel5->setText( tr( "Remote path" ) ); |
254 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 257 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
255 | 258 | ||
256 | 259 | ||
257 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 260 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
258 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 261 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
@@ -342,17 +345,17 @@ void OpieFtp::cleanUp() | |||
342 | file.remove(); | 345 | file.remove(); |
343 | Config cfg("opieftp"); | 346 | Config cfg("opieftp"); |
344 | cfg.setGroup("Server"); | 347 | cfg.setGroup("Server"); |
345 | cfg.writeEntry("currentServer", currentServerConfig); | 348 | cfg.writeEntry("currentServer", currentServerConfig); |
346 | 349 | ||
347 | exit(0); | 350 | exit(0); |
348 | } | 351 | } |
349 | 352 | ||
350 | void OpieFtp::tabChanged(QWidget *w) | 353 | void OpieFtp::tabChanged(QWidget *) |
351 | { | 354 | { |
352 | if (TabWidget->currentPageIndex() == 0) { | 355 | if (TabWidget->currentPageIndex() == 0) { |
353 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 356 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
354 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 357 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
355 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 358 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
356 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 359 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
357 | if(cdUpButton->isHidden()) | 360 | if(cdUpButton->isHidden()) |
358 | cdUpButton->show(); | 361 | cdUpButton->show(); |
@@ -384,29 +387,29 @@ void OpieFtp::newConnection() | |||
384 | UsernameComboBox->lineEdit()->setText(""); | 387 | UsernameComboBox->lineEdit()->setText(""); |
385 | PasswordEdit->setText( "" ); | 388 | PasswordEdit->setText( "" ); |
386 | ServerComboBox->lineEdit()->setText( ""); | 389 | ServerComboBox->lineEdit()->setText( ""); |
387 | remotePath->setText( currentRemoteDir = "/"); | 390 | remotePath->setText( currentRemoteDir = "/"); |
388 | PortSpinBox->setValue( 21); | 391 | PortSpinBox->setValue( 21); |
389 | TabWidget->setCurrentPage(2); | 392 | TabWidget->setCurrentPage(2); |
390 | } | 393 | } |
391 | 394 | ||
392 | void OpieFtp::serverComboEdited(const QString & edit) | 395 | void OpieFtp::serverComboEdited(const QString & ) |
393 | { | 396 | { |
394 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 397 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
395 | // qDebug("ServerComboEdited"); | 398 | // qDebug("ServerComboEdited"); |
396 | // // currentServerConfig = -1; | 399 | // // currentServerConfig = -1; |
397 | // } | 400 | // } |
398 | } | 401 | } |
399 | 402 | ||
400 | void OpieFtp::UsernameComboBoxEdited(const QString & use) { | 403 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
401 | // currentServerConfig = -1; | 404 | // currentServerConfig = -1; |
402 | } | 405 | } |
403 | 406 | ||
404 | void OpieFtp::PasswordEditEdited(const QString & pass) { | 407 | void OpieFtp::PasswordEditEdited(const QString & ) { |
405 | // currentServerConfig = -1; | 408 | // currentServerConfig = -1; |
406 | } | 409 | } |
407 | 410 | ||
408 | void OpieFtp::connectorBtnToggled(bool On) | 411 | void OpieFtp::connectorBtnToggled(bool On) |
409 | { | 412 | { |
410 | if(On) { | 413 | if(On) { |
411 | connector(); | 414 | connector(); |
412 | } else { | 415 | } else { |
@@ -437,17 +440,17 @@ void OpieFtp::connector() | |||
437 | QString ftp_host = ServerComboBox->currentText(); | 440 | QString ftp_host = ServerComboBox->currentText(); |
438 | QString ftp_user = UsernameComboBox->currentText(); | 441 | QString ftp_user = UsernameComboBox->currentText(); |
439 | QString ftp_pass = PasswordEdit->text(); | 442 | QString ftp_pass = PasswordEdit->text(); |
440 | QString port=PortSpinBox->cleanText(); | 443 | QString port=PortSpinBox->cleanText(); |
441 | port.stripWhiteSpace(); | 444 | port.stripWhiteSpace(); |
442 | 445 | ||
443 | Config cfg("opieftp"); | 446 | Config cfg("opieftp"); |
444 | cfg.setGroup("Server"); | 447 | cfg.setGroup("Server"); |
445 | int current=cfg.readNumEntry("currentServer", 1); | 448 | // int current=cfg.readNumEntry("currentServer", 1); |
446 | 449 | ||
447 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | 450 | // if(ftp_host!= cfg.readEntry(QString::number( current))) |
448 | // currentServerConfig=-1; | 451 | // currentServerConfig=-1; |
449 | // cfg.setGroup(QString::number(current)); | 452 | // cfg.setGroup(QString::number(current)); |
450 | // if( ftp_user != cfg.readEntry("Username")) | 453 | // if( ftp_user != cfg.readEntry("Username")) |
451 | // currentServerConfig=-1; | 454 | // currentServerConfig=-1; |
452 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) | 455 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) |
453 | // currentServerConfig=-1; | 456 | // currentServerConfig=-1; |
@@ -648,22 +651,22 @@ void OpieFtp::populateLocalView() | |||
648 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 651 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
649 | QFileInfoListIterator it(*list); | 652 | QFileInfoListIterator it(*list); |
650 | QFileInfo *fi; | 653 | QFileInfo *fi; |
651 | while ( (fi=it.current()) ) { | 654 | while ( (fi=it.current()) ) { |
652 | if (fi->isSymLink() ){ | 655 | if (fi->isSymLink() ){ |
653 | QString symLink=fi->readLink(); | 656 | QString symLink=fi->readLink(); |
654 | // qDebug("Symlink detected "+symLink); | 657 | // qDebug("Symlink detected "+symLink); |
655 | QFileInfo sym( symLink); | 658 | QFileInfo sym( symLink); |
656 | fileS.sprintf( "%10li", sym.size() ); | 659 | fileS.sprintf( "%10i", sym.size() ); |
657 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 660 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
658 | fileDate = sym.lastModified().toString(); | 661 | fileDate = sym.lastModified().toString(); |
659 | } else { | 662 | } else { |
660 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 663 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
661 | fileS.sprintf( "%10li", fi->size() ); | 664 | fileS.sprintf( "%10i", fi->size() ); |
662 | fileL.sprintf( "%s",fi->fileName().data() ); | 665 | fileL.sprintf( "%s",fi->fileName().data() ); |
663 | fileDate= fi->lastModified().toString(); | 666 | fileDate= fi->lastModified().toString(); |
664 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 667 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
665 | fileL+="/"; | 668 | fileL+="/"; |
666 | isDir=TRUE; | 669 | isDir=TRUE; |
667 | // qDebug( fileL); | 670 | // qDebug( fileL); |
668 | } | 671 | } |
669 | } | 672 | } |
@@ -809,16 +812,18 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
809 | } | 812 | } |
810 | } | 813 | } |
811 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 814 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
812 | if(currentRemoteDir.right(1) !="/") | 815 | if(currentRemoteDir.right(1) !="/") |
813 | currentRemoteDir +="/"; | 816 | currentRemoteDir +="/"; |
814 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 817 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
815 | fillRemoteCombo( (const QString &)currentRemoteDir); | 818 | fillRemoteCombo( (const QString &)currentRemoteDir); |
816 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 819 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
820 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | ||
821 | |||
817 | } | 822 | } |
818 | } | 823 | } |
819 | 824 | ||
820 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 825 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
821 | { | 826 | { |
822 | if(selectedItem!= NULL) { | 827 | if(selectedItem!= NULL) { |
823 | 828 | ||
824 | QString strItem=selectedItem->text(0); | 829 | QString strItem=selectedItem->text(0); |
@@ -850,16 +855,17 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) | |||
850 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 855 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
851 | if( QFile::exists(strItem ) ) { | 856 | if( QFile::exists(strItem ) ) { |
852 | // qDebug("upload "+strItem); | 857 | // qDebug("upload "+strItem); |
853 | return; | 858 | return; |
854 | } | 859 | } |
855 | } //end not symlink | 860 | } //end not symlink |
856 | chdir(strItem.latin1()); | 861 | chdir(strItem.latin1()); |
857 | } | 862 | } |
863 | Local_View->ensureItemVisible(Local_View->firstChild()); | ||
858 | } | 864 | } |
859 | } | 865 | } |
860 | 866 | ||
861 | void OpieFtp::doLocalCd() | 867 | void OpieFtp::doLocalCd() |
862 | { | 868 | { |
863 | localListClicked( Local_View->currentItem()); | 869 | localListClicked( Local_View->currentItem()); |
864 | } | 870 | } |
865 | 871 | ||
@@ -881,25 +887,25 @@ void OpieFtp::showHidden() | |||
881 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 887 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
882 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 888 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
883 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 889 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
884 | b=FALSE; | 890 | b=FALSE; |
885 | } | 891 | } |
886 | populateLocalView(); | 892 | populateLocalView(); |
887 | } | 893 | } |
888 | 894 | ||
889 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 895 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int) |
890 | { | 896 | { |
891 | // if(item) | 897 | // if(item) |
892 | if (mouse == 2) { | 898 | if (mouse == 2) { |
893 | showLocalMenu(item); | 899 | showLocalMenu(item); |
894 | } | 900 | } |
895 | } | 901 | } |
896 | 902 | ||
897 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 903 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int ) |
898 | { | 904 | { |
899 | if(mouse == 2) { | 905 | if(mouse == 2) { |
900 | showRemoteMenu(item); | 906 | showRemoteMenu(item); |
901 | } | 907 | } |
902 | } | 908 | } |
903 | 909 | ||
904 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 910 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
905 | { | 911 | { |
@@ -1300,17 +1306,17 @@ void OpieFtp::serverComboSelected(int index) | |||
1300 | { | 1306 | { |
1301 | currentServerConfig = index+1; | 1307 | currentServerConfig = index+1; |
1302 | qDebug("server combo selected %d", index+1); | 1308 | qDebug("server combo selected %d", index+1); |
1303 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1309 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1304 | // remoteServerStr = ServerComboBox->text(index); | 1310 | // remoteServerStr = ServerComboBox->text(index); |
1305 | 1311 | ||
1306 | Config cfg("opieftp"); | 1312 | Config cfg("opieftp"); |
1307 | cfg.setGroup("Server"); | 1313 | cfg.setGroup("Server"); |
1308 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1314 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1309 | 1315 | ||
1310 | temp.setNum(index+1); | 1316 | temp.setNum(index+1); |
1311 | remoteServerStr = cfg.readEntry( temp,""); | 1317 | remoteServerStr = cfg.readEntry( temp,""); |
1312 | 1318 | ||
1313 | qDebug("Group" +temp); | 1319 | qDebug("Group" +temp); |
1314 | cfg.setGroup(temp); | 1320 | cfg.setGroup(temp); |
1315 | // qDebug(temp); | 1321 | // qDebug(temp); |
1316 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1322 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |