summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp
authormickeyl <mickeyl>2003-10-29 18:18:19 (UTC)
committer mickeyl <mickeyl>2003-10-29 18:18:19 (UTC)
commit1af1f1d9f398d38a2bc666cd2edff5725da7a770 (patch) (unidiff)
treeb3bb0d90cafc1e933b5b9297a7b2669ce3b184ea /noncore/net/opieftp
parent35615947e11575a61456c8483e7f6d67fe59d5ed (diff)
downloadopie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.zip
opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.gz
opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.bz2
mrege noncore/net/*
Diffstat (limited to 'noncore/net/opieftp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/main.cpp15
-rw-r--r--noncore/net/opieftp/opieftp.cpp58
-rw-r--r--noncore/net/opieftp/opieftp.h3
-rw-r--r--noncore/net/opieftp/opieftp.pro6
4 files changed, 35 insertions, 47 deletions
diff --git a/noncore/net/opieftp/main.cpp b/noncore/net/opieftp/main.cpp
index 4f5a7d4..0217e41 100644
--- a/noncore/net/opieftp/main.cpp
+++ b/noncore/net/opieftp/main.cpp
@@ -1,27 +1,16 @@
1 1
2/*************************************************************************** 2/***************************************************************************
3 main.cpp - description 3 main.cpp - description
4 ------------------- 4 -------------------
5 begin : March 10, 2002 5 begin : March 10, 2002
6 copyright : (C) 2002 by llornkcor 6 copyright : (C) 2002 by llornkcor
7 email : ljp@llornkcor.com 7 email : ljp@llornkcor.com
8 * This program is free software; you can redistribute it and/or modify * 8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by * 9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or * 10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. * 11 * (at your option) any later version. *
12 ***************************************************************************/ 12 ***************************************************************************/
13#include <qpe/qpeapplication.h> 13#include <opie/oapplicationfactory.h>
14
15
16
17#include "opieftp.h" 14#include "opieftp.h"
18 15
19int main(int argc, char *argv[]) 16OPIE_EXPORT_APP( OApplicationFactory<OpieFtp> )
20{
21 QPEApplication a(argc, argv);
22
23 OpieFtp opieftp;
24 a.showMainWidget( &opieftp);
25 return a.exec();
26}
27
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 269449e..ee7d32f 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -48,49 +48,49 @@ static netbuf *conn=NULL;
48 48
49static int log_progress(netbuf *, int xfered, void *) 49static int log_progress(netbuf *, int xfered, void *)
50{ 50{
51// int fsz = *(int *)arg; 51// int fsz = *(int *)arg;
52// int pct = (xfered * 100) / fsz; 52// int pct = (xfered * 100) / fsz;
53// printf("%3d%%\r", pct); 53// printf("%3d%%\r", pct);
54// fflush(stdout); 54// fflush(stdout);
55 ProgressBar->setProgress(xfered); 55 ProgressBar->setProgress(xfered);
56 qApp->processEvents(); 56 qApp->processEvents();
57 return 1; 57 return 1;
58} 58}
59 59
60OpieFtp::OpieFtp( ) 60OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
61 : QMainWindow( ) 61 : QMainWindow( parent, name, fl )
62{ 62{
63 setCaption( tr( "OpieFtp" ) ); 63 setCaption( tr( "OpieFtp" ) );
64 fuckeduphack=FALSE; 64 fuckeduphack=FALSE;
65 QGridLayout *layout = new QGridLayout( this ); 65 QGridLayout *layout = new QGridLayout( this );
66 layout->setSpacing( 2); 66 layout->setSpacing( 2);
67 layout->setMargin( 2); 67 layout->setMargin( 2);
68 68
69 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 69 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
70 70
71 QPEMenuBar *menuBar = new QPEMenuBar(this); 71 QPEMenuBar *menuBar = new QPEMenuBar(this);
72// QPEToolBar *menuBar = new QPEToolBar(this); 72// QPEToolBar *menuBar = new QPEToolBar(this);
73// menuBar->setHorizontalStretchable( TRUE ); 73// menuBar->setHorizontalStretchable( TRUE );
74 74
75 QWMatrix matrix; 75 QWMatrix matrix;
76 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 76 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
77 matrix.scale( .4, .4); 77 matrix.scale( .4, .4);
78 unknownXpm = pix.xForm(matrix); 78 unknownXpm = pix.xForm(matrix);
79 79
80 connectionMenu = new QPopupMenu( this ); 80 connectionMenu = new QPopupMenu( this );
81 localMenu = new QPopupMenu( this ); 81 localMenu = new QPopupMenu( this );
82 remoteMenu = new QPopupMenu( this ); 82 remoteMenu = new QPopupMenu( this );
83 tabMenu = new QPopupMenu( this ); 83 tabMenu = new QPopupMenu( this );
84 84
85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
86 86
87 menuBar->insertItem( tr( "Connection" ), connectionMenu); 87 menuBar->insertItem( tr( "Connection" ), connectionMenu);
88// menuBar->insertItem( tr( "Local" ), localMenu); 88// menuBar->insertItem( tr( "Local" ), localMenu);
89// menuBar->insertItem( tr( "Remote" ), remoteMenu); 89// menuBar->insertItem( tr( "Remote" ), remoteMenu);
90 menuBar->insertItem( tr( "View" ), tabMenu); 90 menuBar->insertItem( tr( "View" ), tabMenu);
91 91
92 tabMenu->insertItem( tr( "Local" ), localMenu); 92 tabMenu->insertItem( tr( "Local" ), localMenu);
93 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 93 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
94 94
95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
@@ -260,36 +260,36 @@ OpieFtp::OpieFtp( )
260 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 260 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
261 261
262 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 262 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
263 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 263 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
264 PortSpinBox->setMaxValue(32786); 264 PortSpinBox->setMaxValue(32786);
265 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 265 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
266 266
267 serverListView = new QListBox( tab_3, "ServerListView" ); 267 serverListView = new QListBox( tab_3, "ServerListView" );
268 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 268 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
269 269
270 connect( serverListView, SIGNAL( highlighted( const QString &)), 270 connect( serverListView, SIGNAL( highlighted( const QString &)),
271 this,SLOT( serverListClicked( const QString &) ) ); 271 this,SLOT( serverListClicked( const QString &) ) );
272 272
273 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 273 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
274 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 274 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
275 connectServerBtn->setToggleButton(TRUE); 275 connectServerBtn->setToggleButton(TRUE);
276 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 276 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
277 277
278 newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); 278 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
279 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 279 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
280 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 280 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
281 281
282 QPushButton *deleteServerBtn; 282 QPushButton *deleteServerBtn;
283 deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); 283 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
284 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 284 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
285 285
286 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 286 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
287 287
288 288
289 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 289 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
290 tabLayout_3->addItem( spacer, 5, 0 ); 290 tabLayout_3->addItem( spacer, 5, 0 );
291 291
292 TabWidget->insertTab( tab_3, tr( "Config" ) ); 292 TabWidget->insertTab( tab_3, tr( "Config" ) );
293 293
294 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 294 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
295 this,SLOT(tabChanged(QWidget*))); 295 this,SLOT(tabChanged(QWidget*)));
@@ -310,25 +310,25 @@ OpieFtp::OpieFtp( )
310 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 310 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
311 this,SLOT(currentPathComboChanged())); 311 this,SLOT(currentPathComboChanged()));
312 312
313 ProgressBar = new QProgressBar( this, "ProgressBar" ); 313 ProgressBar = new QProgressBar( this, "ProgressBar" );
314 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 314 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
315 ProgressBar->setMaximumHeight(10); 315 ProgressBar->setMaximumHeight(10);
316 filterStr="*"; 316 filterStr="*";
317 b=FALSE; 317 b=FALSE;
318 populateLocalView(); 318 populateLocalView();
319 readConfig(); 319 readConfig();
320 320
321// ServerComboBox->setCurrentItem(currentServerConfig); 321// ServerComboBox->setCurrentItem(currentServerConfig);
322 322
323 TabWidget->setCurrentPage(2); 323 TabWidget->setCurrentPage(2);
324} 324}
325 325
326OpieFtp::~OpieFtp() 326OpieFtp::~OpieFtp()
327{ 327{
328} 328}
329 329
330void OpieFtp::cleanUp() 330void OpieFtp::cleanUp()
331{ 331{
332 if(conn) 332 if(conn)
333 FtpQuit(conn); 333 FtpQuit(conn);
334 QString sfile=QDir::homeDirPath(); 334 QString sfile=QDir::homeDirPath();
@@ -348,25 +348,25 @@ void OpieFtp::cleanUp()
348 348
349void OpieFtp::tabChanged(QWidget *) 349void OpieFtp::tabChanged(QWidget *)
350{ 350{
351 if (TabWidget->currentPageIndex() == 0) { 351 if (TabWidget->currentPageIndex() == 0) {
352 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 352 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
353 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 353 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
354 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 354 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
355 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 355 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
356 if(cdUpButton->isHidden()) 356 if(cdUpButton->isHidden())
357 cdUpButton->show(); 357 cdUpButton->show();
358 if(homeButton->isHidden()) 358 if(homeButton->isHidden())
359 homeButton->show(); 359 homeButton->show();
360 360
361 } 361 }
362 if (TabWidget->currentPageIndex() == 1) { 362 if (TabWidget->currentPageIndex() == 1) {
363 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 363 currentPathCombo->lineEdit()->setText( currentRemoteDir );
364 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 364 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
365 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 365 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
366 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 366 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
367 if(cdUpButton->isHidden()) 367 if(cdUpButton->isHidden())
368 cdUpButton->show(); 368 cdUpButton->show();
369 homeButton->hide(); 369 homeButton->hide();
370 370
371 } 371 }
372 if (TabWidget->currentPageIndex() == 2) { 372 if (TabWidget->currentPageIndex() == 2) {
@@ -440,25 +440,25 @@ void OpieFtp::connector()
440 port.stripWhiteSpace(); 440 port.stripWhiteSpace();
441 441
442 Config cfg("opieftp"); 442 Config cfg("opieftp");
443 cfg.setGroup("Server"); 443 cfg.setGroup("Server");
444// int current=cfg.readNumEntry("currentServer", 1); 444// int current=cfg.readNumEntry("currentServer", 1);
445 445
446// if(ftp_host!= cfg.readEntry(QString::number( current))) 446// if(ftp_host!= cfg.readEntry(QString::number( current)))
447// currentServerConfig=-1; 447// currentServerConfig=-1;
448// cfg.setGroup(QString::number(current)); 448// cfg.setGroup(QString::number(current));
449// if( ftp_user != cfg.readEntry("Username")) 449// if( ftp_user != cfg.readEntry("Username"))
450// currentServerConfig=-1; 450// currentServerConfig=-1;
451// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) 451// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
452// currentServerConfig=-1; 452// currentServerConfig=-1;
453 453
454 454
455 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 455 if(ftp_host.find("ftp://",0, TRUE) != -1 )
456 ftp_host=ftp_host.right(ftp_host.length()-6); 456 ftp_host=ftp_host.right(ftp_host.length()-6);
457 ftp_host+=":"+port; 457 ftp_host+=":"+port;
458 458
459 if (!FtpConnect( ftp_host.latin1(), &conn)) { 459 if (!FtpConnect( ftp_host.latin1(), &conn)) {
460 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 460 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
461 connectServerBtn->setOn(FALSE); 461 connectServerBtn->setOn(FALSE);
462 connectServerBtn->setText( tr("Connect")); 462 connectServerBtn->setText( tr("Connect"));
463 return ; 463 return ;
464 } 464 }
@@ -584,25 +584,25 @@ void OpieFtp::remoteDownload()
584 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 584 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
585 msg.replace(QRegExp(":"),"\n"); 585 msg.replace(QRegExp(":"),"\n");
586 QMessageBox::message(tr("Note"),msg); 586 QMessageBox::message(tr("Note"),msg);
587 } 587 }
588 ProgressBar->reset(); 588 ProgressBar->reset();
589 nullifyCallBack(); 589 nullifyCallBack();
590 it.current()->setSelected(FALSE); 590 it.current()->setSelected(FALSE);
591 } 591 }
592 } 592 }
593 for ( ; it.current(); ++it ) { 593 for ( ; it.current(); ++it ) {
594 Remote_View->clearSelection(); 594 Remote_View->clearSelection();
595 } 595 }
596 Remote_View->setFocus(); 596 Remote_View->setFocus();
597 TabWidget->setCurrentPage(0); 597 TabWidget->setCurrentPage(0);
598 populateLocalView(); 598 populateLocalView();
599// QCopEnvelope ( "QPE/System", "notBusy()" ); 599// QCopEnvelope ( "QPE/System", "notBusy()" );
600} 600}
601 601
602bool OpieFtp::remoteDirList(const QString &dir) 602bool OpieFtp::remoteDirList(const QString &dir)
603{ 603{
604 QString tmp = QDir::homeDirPath(); 604 QString tmp = QDir::homeDirPath();
605 if(tmp.right(1) != "/") 605 if(tmp.right(1) != "/")
606 tmp+="/._temp"; 606 tmp+="/._temp";
607 else 607 else
608 tmp+="._temp"; 608 tmp+="._temp";
@@ -660,25 +660,25 @@ void OpieFtp::populateLocalView()
660 fileS.sprintf( "%10i", fi->size() ); 660 fileS.sprintf( "%10i", fi->size() );
661 fileL.sprintf( "%s",fi->fileName().data() ); 661 fileL.sprintf( "%s",fi->fileName().data() );
662 fileDate= fi->lastModified().toString(); 662 fileDate= fi->lastModified().toString();
663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
664 fileL+="/"; 664 fileL+="/";
665 isDir=TRUE; 665 isDir=TRUE;
666// qDebug( fileL); 666// qDebug( fileL);
667 } 667 }
668 } 668 }
669 if(fileL !="./" && fi->exists()) { 669 if(fileL !="./" && fi->exists()) {
670 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 670 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
671 QPixmap pm; 671 QPixmap pm;
672 672
673 if(isDir || fileL.find("/",0,TRUE) != -1) { 673 if(isDir || fileL.find("/",0,TRUE) != -1) {
674 if( !QDir( fi->filePath() ).isReadable()) 674 if( !QDir( fi->filePath() ).isReadable())
675 pm = Resource::loadPixmap( "lockedfolder" ); 675 pm = Resource::loadPixmap( "lockedfolder" );
676 else 676 else
677 pm= Resource::loadPixmap( "folder" ); 677 pm= Resource::loadPixmap( "folder" );
678 item->setPixmap( 0,pm ); 678 item->setPixmap( 0,pm );
679 } else { 679 } else {
680 if( !fi->isReadable() ) 680 if( !fi->isReadable() )
681 pm = Resource::loadPixmap( "locked" ); 681 pm = Resource::loadPixmap( "locked" );
682 else { 682 else {
683 MimeType mt(fi->filePath()); 683 MimeType mt(fi->filePath());
684 pm=mt.pixmap(); //sets the correct pixmap for mimetype 684 pm=mt.pixmap(); //sets the correct pixmap for mimetype
@@ -720,25 +720,25 @@ bool OpieFtp::populateRemoteView( )
720 QString fileL, fileS, fileDate; 720 QString fileL, fileS, fileDate;
721 if ( file.open(IO_ReadOnly)) { 721 if ( file.open(IO_ReadOnly)) {
722 QTextStream t( &file ); // use a text stream 722 QTextStream t( &file ); // use a text stream
723 while ( !t.eof()) { 723 while ( !t.eof()) {
724 s = t.readLine(); 724 s = t.readLine();
725 725
726 if(s.find("total",0,TRUE) == 0) 726 if(s.find("total",0,TRUE) == 0)
727 continue; 727 continue;
728 728
729 int len, month = monthRe.match(s, 0, &len); 729 int len, month = monthRe.match(s, 0, &len);
730 fileDate = s.mid(month + 1, len - 2); // minus spaces 730 fileDate = s.mid(month + 1, len - 2); // minus spaces
731 fileL = s.right(s.length() - month - len); 731 fileL = s.right(s.length() - month - len);
732 if(s.left(1) == "d") 732 if(s.left(1) == "d")
733 fileL = fileL+"/"; 733 fileL = fileL+"/";
734 fileS = s.mid(month - 8, 8); // FIXME 734 fileS = s.mid(month - 8, 8); // FIXME
735 fileS = fileS.stripWhiteSpace(); 735 fileS = fileS.stripWhiteSpace();
736 736
737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
739 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 739 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
740// if(itemDir) 740// if(itemDir)
741 item->moveItem(itemDir); 741 item->moveItem(itemDir);
742 itemDir=item; 742 itemDir=item;
743 } else { 743 } else {
744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
@@ -806,68 +806,68 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
806 } 806 }
807 } else { 807 } else {
808// QCopEnvelope ( "QPE/System", "notBusy()" ); 808// QCopEnvelope ( "QPE/System", "notBusy()" );
809 return; 809 return;
810 } 810 }
811 } 811 }
812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
813 if(currentRemoteDir.right(1) !="/") 813 if(currentRemoteDir.right(1) !="/")
814 currentRemoteDir +="/"; 814 currentRemoteDir +="/";
815 currentPathCombo->lineEdit()->setText( currentRemoteDir); 815 currentPathCombo->lineEdit()->setText( currentRemoteDir);
816 fillRemoteCombo( (const QString &)currentRemoteDir); 816 fillRemoteCombo( (const QString &)currentRemoteDir);
817// QCopEnvelope ( "QPE/System", "notBusy()" ); 817// QCopEnvelope ( "QPE/System", "notBusy()" );
818 Remote_View->ensureItemVisible(Remote_View->firstChild()); 818 Remote_View->ensureItemVisible(Remote_View->firstChild());
819 819
820 } 820 }
821} 821}
822 822
823void OpieFtp::localListClicked(QListViewItem *selectedItem) 823void OpieFtp::localListClicked(QListViewItem *selectedItem)
824{ 824{
825 if(selectedItem!= NULL) { 825 if(selectedItem!= NULL) {
826 826
827 QString strItem=selectedItem->text(0); 827 QString strItem=selectedItem->text(0);
828 QString strSize=selectedItem->text(1); 828 QString strSize=selectedItem->text(1);
829 strSize=strSize.stripWhiteSpace(); 829 strSize=strSize.stripWhiteSpace();
830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
831 // is symlink 831 // is symlink
832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
833 if(QDir(strItem2).exists() ) { 833 if(QDir(strItem2).exists() ) {
834 currentDir.cd(strItem2, TRUE); 834 currentDir.cd(strItem2, TRUE);
835 populateLocalView(); 835 populateLocalView();
836 } 836 }
837 } else { // not a symlink 837 } else { // not a symlink
838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
839 839
840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
842 currentDir.cd(strItem,FALSE); 842 currentDir.cd(strItem,FALSE);
843 populateLocalView(); 843 populateLocalView();
844 } else { 844 } else {
845 currentDir.cdUp(); 845 currentDir.cdUp();
846 populateLocalView(); 846 populateLocalView();
847 } 847 }
848 if(QDir(strItem).exists()){ 848 if(QDir(strItem).exists()){
849 currentDir.cd(strItem, TRUE); 849 currentDir.cd(strItem, TRUE);
850 populateLocalView(); 850 populateLocalView();
851 } 851 }
852 } else { 852 } else {
853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
854 if( QFile::exists(strItem ) ) { 854 if( QFile::exists(strItem ) ) {
855 // qDebug("upload "+strItem); 855 // qDebug("upload "+strItem);
856 return; 856 return;
857 } 857 }
858 } //end not symlink 858 } //end not symlink
859 chdir(strItem.latin1()); 859 chdir(strItem.latin1());
860 } 860 }
861 Local_View->ensureItemVisible(Local_View->firstChild()); 861 Local_View->ensureItemVisible(Local_View->firstChild());
862 } 862 }
863} 863}
864 864
865void OpieFtp::doLocalCd() 865void OpieFtp::doLocalCd()
866{ 866{
867 localListClicked( Local_View->currentItem()); 867 localListClicked( Local_View->currentItem());
868} 868}
869 869
870void OpieFtp:: doRemoteCd() 870void OpieFtp:: doRemoteCd()
871{ 871{
872 remoteListClicked( Remote_View->currentItem()); 872 remoteListClicked( Remote_View->currentItem());
873 873
@@ -963,58 +963,58 @@ void OpieFtp::localMakDir()
963 } 963 }
964 populateLocalView(); 964 populateLocalView();
965} 965}
966 966
967void OpieFtp::localDelete() 967void OpieFtp::localDelete()
968{ 968{
969 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 969 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
970 QListViewItemIterator it( Local_View ); 970 QListViewItemIterator it( Local_View );
971 for ( ; it.current(); ++it ) { 971 for ( ; it.current(); ++it ) {
972 if ( it.current()->isSelected() ) { 972 if ( it.current()->isSelected() ) {
973 QString f = it.current()->text(0); 973 QString f = it.current()->text(0);
974 it.current()->setSelected(FALSE); 974 it.current()->setSelected(FALSE);
975 975
976// QString f = Local_View->currentItem()->text(0); 976// QString f = Local_View->currentItem()->text(0);
977 if(QDir(f).exists() ) { 977 if(QDir(f).exists() ) {
978 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 978 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
979 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 979 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
980 case 0: { 980 case 0: {
981 f=currentDir.canonicalPath()+"/"+f; 981 f=currentDir.canonicalPath()+"/"+f;
982 QString cmd="rmdir "+f; 982 QString cmd="rmdir "+f;
983 system( cmd.latin1()); 983 system( cmd.latin1());
984 } 984 }
985 break; 985 break;
986 case 1: 986 case 1:
987 // exit 987 // exit
988 break; 988 break;
989 }; 989 };
990 990
991 } else { 991 } else {
992 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 992 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
993 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 993 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
994 case 0: { 994 case 0: {
995 f=currentDir.canonicalPath()+"/"+f; 995 f=currentDir.canonicalPath()+"/"+f;
996 QString cmd="rm "+f; 996 QString cmd="rm "+f;
997 system( cmd.latin1()); 997 system( cmd.latin1());
998 } 998 }
999 break; 999 break;
1000 case 1: 1000 case 1:
1001 // exit 1001 // exit
1002 break; 1002 break;
1003 }; 1003 };
1004 } 1004 }
1005 } 1005 }
1006 } 1006 }
1007 populateLocalView(); 1007 populateLocalView();
1008 1008
1009} 1009}
1010 1010
1011void OpieFtp::remoteMakDir() 1011void OpieFtp::remoteMakDir()
1012{ 1012{
1013 InputDialog *fileDlg; 1013 InputDialog *fileDlg;
1014 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 1014 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
1015 fileDlg->exec(); 1015 fileDlg->exec();
1016 if( fileDlg->result() == 1 ) { 1016 if( fileDlg->result() == 1 ) {
1017 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 1017 QString filename = fileDlg->LineEdit1->text();//+".playlist";
1018 QString tmp=currentRemoteDir+filename; 1018 QString tmp=currentRemoteDir+filename;
1019// QCopEnvelope ( "QPE/System", "busy()" ); 1019// QCopEnvelope ( "QPE/System", "busy()" );
1020 if(FtpMkdir( tmp.latin1(), conn) == 0) { 1020 if(FtpMkdir( tmp.latin1(), conn) == 0) {
@@ -1192,28 +1192,28 @@ void OpieFtp::switchToRemoteTab()
1192 1192
1193void OpieFtp::switchToConfigTab() 1193void OpieFtp::switchToConfigTab()
1194{ 1194{
1195 TabWidget->setCurrentPage(2); 1195 TabWidget->setCurrentPage(2);
1196} 1196}
1197 1197
1198void OpieFtp::readConfig() 1198void OpieFtp::readConfig()
1199{ 1199{
1200 fillCombos(); 1200 fillCombos();
1201 Config cfg("opieftp"); 1201 Config cfg("opieftp");
1202 cfg.setGroup("Server"); 1202 cfg.setGroup("Server");
1203 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1203 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1204 1204
1205// qDebug("Reading %d", currentServerConfig); 1205// qDebug("Reading %d", currentServerConfig);
1206 serverComboSelected( currentServerConfig-1); 1206 serverComboSelected( currentServerConfig-1);
1207 1207
1208} 1208}
1209 1209
1210void OpieFtp::writeConfig() 1210void OpieFtp::writeConfig()
1211{ 1211{
1212 qDebug("write config"); 1212 qDebug("write config");
1213 Config cfg("opieftp"); 1213 Config cfg("opieftp");
1214 cfg.setGroup("Server"); 1214 cfg.setGroup("Server");
1215 1215
1216 QString username, remoteServerStr, remotePathStr, password, port, temp; 1216 QString username, remoteServerStr, remotePathStr, password, port, temp;
1217 1217
1218 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1218 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1219 1219
@@ -1245,25 +1245,25 @@ void OpieFtp::writeConfig()
1245 cfg.setGroup(temp); 1245 cfg.setGroup(temp);
1246 if(!newServerName.isEmpty()) 1246 if(!newServerName.isEmpty())
1247 cfg.writeEntry("ServerName", newServerName); 1247 cfg.writeEntry("ServerName", newServerName);
1248 1248
1249 cfg.writeEntry("RemotePath", remotePath->text()); 1249 cfg.writeEntry("RemotePath", remotePath->text());
1250 1250
1251 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1251 cfg.writeEntry("Username", UsernameComboBox->currentText());
1252 1252
1253 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1253 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1254 cfg.setGroup("Server"); 1254 cfg.setGroup("Server");
1255 1255
1256 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1256 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1257 1257
1258 } 1258 }
1259} 1259}
1260 1260
1261void OpieFtp::clearCombos() { 1261void OpieFtp::clearCombos() {
1262 qDebug("clearing"); 1262 qDebug("clearing");
1263 ServerComboBox->clear(); 1263 ServerComboBox->clear();
1264 UsernameComboBox->clear(); 1264 UsernameComboBox->clear();
1265 PasswordEdit->clear(); 1265 PasswordEdit->clear();
1266 serverListView->clear(); 1266 serverListView->clear();
1267} 1267}
1268 1268
1269 1269
@@ -1317,57 +1317,57 @@ void OpieFtp::serverComboSelected(int index)
1317 1317
1318 temp.setNum(index+1); 1318 temp.setNum(index+1);
1319 remoteServerStr = cfg.readEntry( temp,""); 1319 remoteServerStr = cfg.readEntry( temp,"");
1320 1320
1321 qDebug("Group" +temp); 1321 qDebug("Group" +temp);
1322 cfg.setGroup(temp); 1322 cfg.setGroup(temp);
1323// qDebug(temp); 1323// qDebug(temp);
1324 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1324 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1325 port = remoteServerStr.right( divider - 1); 1325 port = remoteServerStr.right( divider - 1);
1326 bool ok; 1326 bool ok;
1327 int portInt = port.toInt(&ok,10); 1327 int portInt = port.toInt(&ok,10);
1328 if( portInt == 0) portInt = 21; 1328 if( portInt == 0) portInt = 21;
1329 1329
1330 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1330 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1331 1331
1332 PortSpinBox->setValue( portInt); 1332 PortSpinBox->setValue( portInt);
1333 1333
1334 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1334 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1335 1335
1336 username = cfg.readEntry("Username", "anonymous"); 1336 username = cfg.readEntry("Username", "anonymous");
1337 UsernameComboBox->lineEdit()->setText(username); 1337 UsernameComboBox->lineEdit()->setText(username);
1338 qDebug(username); 1338 qDebug(username);
1339// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1339// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
1340 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1340 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1341// UsernameComboBox 1341// UsernameComboBox
1342// PasswordEdit 1342// PasswordEdit
1343 1343
1344 cfg.setGroup("Server"); 1344 cfg.setGroup("Server");
1345 temp.sprintf("%d",currentServerConfig); 1345 temp.sprintf("%d",currentServerConfig);
1346 cfg.writeEntry("currentServer", temp); 1346 cfg.writeEntry("currentServer", temp);
1347 1347
1348 fuckeduphack = TRUE; 1348 fuckeduphack = TRUE;
1349 serverListView->setCurrentItem( index); 1349 serverListView->setCurrentItem( index);
1350 fuckeduphack=FALSE; 1350 fuckeduphack=FALSE;
1351 qDebug("server list set selected %d",index); 1351 qDebug("server list set selected %d",index);
1352 update(); 1352 update();
1353} 1353}
1354 1354
1355void OpieFtp::deleteServer() 1355void OpieFtp::deleteServer()
1356{ 1356{
1357 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1357 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1358 remoteServerStr = ServerComboBox->currentText( ); 1358 remoteServerStr = ServerComboBox->currentText( );
1359 username = UsernameComboBox->currentText(); 1359 username = UsernameComboBox->currentText();
1360 servername=serverListView->currentText(); 1360 servername=serverListView->currentText();
1361 1361
1362 Config cfg("opieftp"); 1362 Config cfg("opieftp");
1363 cfg.setGroup("Server"); 1363 cfg.setGroup("Server");
1364 QString tempname; 1364 QString tempname;
1365 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1365 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1366 1366
1367 for (int i = 1; i <= numberOfEntries; i++) { 1367 for (int i = 1; i <= numberOfEntries; i++) {
1368 temp.setNum(i); 1368 temp.setNum(i);
1369// cfg.setGroup("Server"); 1369// cfg.setGroup("Server");
1370 cfg.setGroup(QString::number(i)); 1370 cfg.setGroup(QString::number(i));
1371 tempname=cfg.readEntry( "ServerName",""); 1371 tempname=cfg.readEntry( "ServerName","");
1372 1372
1373 if( tempname.find( servername,0,TRUE) != -1 ) { 1373 if( tempname.find( servername,0,TRUE) != -1 ) {
@@ -1484,25 +1484,25 @@ void OpieFtp::NewServer() {
1484 Config cfg("opieftp"); 1484 Config cfg("opieftp");
1485 if( fileDlg->result() == 1 ) { 1485 if( fileDlg->result() == 1 ) {
1486 newServerName = fileDlg->LineEdit1->text(); 1486 newServerName = fileDlg->LineEdit1->text();
1487 for(int i=1;i<serverListView->count();i++) { 1487 for(int i=1;i<serverListView->count();i++) {
1488 cfg.setGroup( QString::number(i)); 1488 cfg.setGroup( QString::number(i));
1489 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) { 1489 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
1490 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken")); 1490 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
1491 return; 1491 return;
1492 } 1492 }
1493 } 1493 }
1494 currentServerConfig =-1; 1494 currentServerConfig =-1;
1495 writeConfig(); 1495 writeConfig();
1496 serverListView->insertItem( newServerName ); 1496 serverListView->insertItem( newServerName );
1497 serverListView->setCurrentItem( serverListView->count()); 1497 serverListView->setCurrentItem( serverListView->count());
1498 } 1498 }
1499} 1499}
1500 1500
1501void OpieFtp::serverListClicked( const QString &item) { 1501void OpieFtp::serverListClicked( const QString &item) {
1502 if(item.isEmpty()) return; 1502 if(item.isEmpty()) return;
1503 Config cfg("opieftp"); 1503 Config cfg("opieftp");
1504 qDebug("highltined "+item); 1504 qDebug("highltined "+item);
1505 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1505 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1506 for (int i = 1; i <= numberOfEntries; i++) { 1506 for (int i = 1; i <= numberOfEntries; i++) {
1507 cfg.setGroup(QString::number(i)); 1507 cfg.setGroup(QString::number(i));
1508 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) 1508 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 9d5d211..7bd615a 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -38,27 +38,28 @@ class QFile;
38class QLineEdit; 38class QLineEdit;
39class QPushButton; 39class QPushButton;
40class QToolButton; 40class QToolButton;
41class QStringList; 41class QStringList;
42class QListBox; 42class QListBox;
43class QTimer; 43class QTimer;
44 44
45class OpieFtp : public QMainWindow 45class OpieFtp : public QMainWindow
46{ 46{
47 Q_OBJECT 47 Q_OBJECT
48 48
49public: 49public:
50 OpieFtp( ); 50 OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
51 ~OpieFtp(); 51 ~OpieFtp();
52 52
53 static QString appName() { return QString::fromLatin1("opieftp"); }
53 QTabWidget *TabWidget; 54 QTabWidget *TabWidget;
54 QWidget *tab, *tab_2, *tab_3; 55 QWidget *tab, *tab_2, *tab_3;
55 QListView *Local_View, *Remote_View; 56 QListView *Local_View, *Remote_View;
56 QListBox *serverListView; 57 QListBox *serverListView;
57 58
58 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; 59 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
59 QLineEdit *PasswordEdit, *remotePath; 60 QLineEdit *PasswordEdit, *remotePath;
60 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 61 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
61 QSpinBox* PortSpinBox; 62 QSpinBox* PortSpinBox;
62 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; 63 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu;
63 QDir currentDir; 64 QDir currentDir;
64 QString currentRemoteDir; 65 QString currentRemoteDir;
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index ac16819..185c341 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,18 +1,16 @@
1TEMPLATE = app 1CONFIG += qt warn_on release quick-app
2CONFIG += qt warn_on release 2HEADERS = opieftp.h inputDialog.h
3HEADERS = opieftp.h inputDialog.h
4SOURCES = opieftp.cpp inputDialog.cpp main.cpp 3SOURCES = opieftp.cpp inputDialog.cpp main.cpp
5TARGET = opieftp 4TARGET = opieftp
6DESTDIR = $(OPIEDIR)/bin
7INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lftplib 7LIBS += -lqpe -lftplib
10 8
11TRANSLATIONS = ../../../i18n/de/opieftp.ts \ 9TRANSLATIONS = ../../../i18n/de/opieftp.ts \
12 ../../../i18n/nl/opieftp.ts \ 10 ../../../i18n/nl/opieftp.ts \
13 ../../../i18n/da/opieftp.ts \ 11 ../../../i18n/da/opieftp.ts \
14 ../../../i18n/xx/opieftp.ts \ 12 ../../../i18n/xx/opieftp.ts \
15 ../../../i18n/en/opieftp.ts \ 13 ../../../i18n/en/opieftp.ts \
16 ../../../i18n/es/opieftp.ts \ 14 ../../../i18n/es/opieftp.ts \
17 ../../../i18n/fr/opieftp.ts \ 15 ../../../i18n/fr/opieftp.ts \
18 ../../../i18n/hu/opieftp.ts \ 16 ../../../i18n/hu/opieftp.ts \