summaryrefslogtreecommitdiff
path: root/noncore/net
Unidiff
Diffstat (limited to 'noncore/net') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp52
-rw-r--r--noncore/net/opieftp/opieftp.h9
2 files changed, 36 insertions, 25 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 37e2134..fd6b028 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -12,24 +12,25 @@
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#include <qpe/mimetype.h>
24 25
25#include <qstringlist.h> 26#include <qstringlist.h>
26#include <qtextstream.h> 27#include <qtextstream.h>
27#include <qpushbutton.h> 28#include <qpushbutton.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29#include <qdatetime.h> 30#include <qdatetime.h>
30#include <qdir.h> 31#include <qdir.h>
31#include <qfile.h> 32#include <qfile.h>
32#include <qstring.h> 33#include <qstring.h>
33#include <qcombobox.h> 34#include <qcombobox.h>
34#include <qpopupmenu.h> 35#include <qpopupmenu.h>
35#include <qlistview.h> 36#include <qlistview.h>
@@ -193,87 +194,88 @@ OpieFtp::OpieFtp( )
193 194
194 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 195 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
195 ServerComboBox->setEditable(TRUE); 196 ServerComboBox->setEditable(TRUE);
196 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 197 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
197 198
198 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 199 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
199 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); 200 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) ));
200 201
201 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 202 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
202 TextLabel5->setText( tr( "Remote path" ) ); 203 TextLabel5->setText( tr( "Remote path" ) );
203 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 204 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
204 205
206
205 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 207 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
206 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 208 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
207 209
208 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 210 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
209 TextLabel4->setText( tr( "Port" ) ); 211 TextLabel4->setText( tr( "Port" ) );
210 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 212 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
211 213
212 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 214 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
213 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 215 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
214 PortSpinBox->setMaxValue(32786); 216 PortSpinBox->setMaxValue(32786);
215 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 217 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
216 218
217 QPushButton *deleteServerBtn; 219 QPushButton *deleteServerBtn;
218 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); 220 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" );
219 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); 221 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3);
220 222
221 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 223 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
222 224
223 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 225 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" );
224 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); 226 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1);
225 connectServerBtn->setToggleButton(TRUE); 227 connectServerBtn->setToggleButton(TRUE);
226 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 228 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
227 229
228
229 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 230 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
230 tabLayout_3->addItem( spacer, 5, 0 ); 231 tabLayout_3->addItem( spacer, 5, 0 );
231 232
232 TabWidget->insertTab( tab_3, tr( "Config" ) ); 233 TabWidget->insertTab( tab_3, tr( "Config" ) );
233 234
234 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 235 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
235 this,SLOT(tabChanged(QWidget*))); 236 this,SLOT(tabChanged(QWidget*)));
236 237
237 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 238 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
238 currentDir.setPath( QDir::currentDirPath()); 239 currentDir.setPath( QDir::currentDirPath());
239// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 240// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
240 241
241 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 242 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
242 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); 243 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 );
243 244 currentPathCombo->setEditable(TRUE);
244 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 245 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
245 246
246 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 247 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
247 this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) ); 248 this, SLOT( currentPathComboActivated( const QString & ) ) );
248 249
249 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 250 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
250 this,SLOT(currentPathComboChanged())); 251 this,SLOT(currentPathComboChanged()));
251 252
252 ProgressBar = new QProgressBar( this, "ProgressBar" ); 253 ProgressBar = new QProgressBar( this, "ProgressBar" );
253 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); 254 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
254 255
255// fillCombos(); 256// fillCombos();
256 257
257#ifdef DEVELOPERS_VERSION 258#ifdef DEVELOPERS_VERSION
258 ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); 259 ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
259 UsernameComboBox->lineEdit()->setText("root"); 260 UsernameComboBox->lineEdit()->setText("root");
260 PortSpinBox->setValue( 4242); 261 PortSpinBox->setValue( 4242);
261 remotePath->setText( currentRemoteDir = "/"); 262 remotePath->setText( currentRemoteDir = "/");
262// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); 263// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) );
263// UsernameComboBox->lineEdit()->setText("llornkcor"); 264// UsernameComboBox->lineEdit()->setText("llornkcor");
264// PortSpinBox->setValue( 21); 265// PortSpinBox->setValue( 21);
265// remotePath->setText( currentRemoteDir = "/home/llornkcor"); 266// remotePath->setText( currentRemoteDir = "/home/llornkcor");
266 PasswordEdit->setText( tr( "" ) ); 267 PasswordEdit->setText( tr( "" ) );
267#endif 268#endif
269
268 filterStr="*"; 270 filterStr="*";
269 b=FALSE; 271 b=FALSE;
270 populateLocalView(); 272 populateLocalView();
271 readConfig(); 273 readConfig();
272 ServerComboBox->setCurrentItem(currentServerConfig); 274 ServerComboBox->setCurrentItem(currentServerConfig);
273 TabWidget->setCurrentPage(2); 275 TabWidget->setCurrentPage(2);
274} 276}
275 277
276OpieFtp::~OpieFtp() 278OpieFtp::~OpieFtp()
277{ 279{
278} 280}
279 281
@@ -317,25 +319,25 @@ void OpieFtp::newConnection()
317 UsernameComboBox->lineEdit()->setText(""); 319 UsernameComboBox->lineEdit()->setText("");
318 PasswordEdit->setText( "" ); 320 PasswordEdit->setText( "" );
319 ServerComboBox->lineEdit()->setText( ""); 321 ServerComboBox->lineEdit()->setText( "");
320 remotePath->setText( currentRemoteDir = "/"); 322 remotePath->setText( currentRemoteDir = "/");
321 PortSpinBox->setValue( 21); 323 PortSpinBox->setValue( 21);
322 TabWidget->setCurrentPage(2); 324 TabWidget->setCurrentPage(2);
323 currentServerConfig = -1; 325 currentServerConfig = -1;
324} 326}
325 327
326void OpieFtp::serverComboEdited(const QString & edit) { 328void OpieFtp::serverComboEdited(const QString & edit) {
327 if( !edit.isEmpty() ) { 329 if( !edit.isEmpty() ) {
328 currentServerConfig = -1; 330 currentServerConfig = -1;
329 qDebug("comboedited"); 331// qDebug("comboedited");
330 } 332 }
331} 333}
332 334
333void OpieFtp::connectorBtnToggled(bool On) 335void OpieFtp::connectorBtnToggled(bool On)
334{ 336{
335 if(On) { 337 if(On) {
336 connector(); 338 connector();
337 } else { 339 } else {
338 disConnector(); 340 disConnector();
339 } 341 }
340 342
341} 343}
@@ -541,42 +543,48 @@ void OpieFtp::populateLocalView()
541 fileDate = sym.lastModified().toString(); 543 fileDate = sym.lastModified().toString();
542 } else { 544 } else {
543// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 545// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
544 fileS.sprintf( "%10li", fi->size() ); 546 fileS.sprintf( "%10li", fi->size() );
545 fileL.sprintf( "%s",fi->fileName().data() ); 547 fileL.sprintf( "%s",fi->fileName().data() );
546 fileDate= fi->lastModified().toString(); 548 fileDate= fi->lastModified().toString();
547 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 549 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
548 fileL+="/"; 550 fileL+="/";
549 isDir=TRUE; 551 isDir=TRUE;
550// qDebug( fileL); 552// qDebug( fileL);
551 } 553 }
552 } 554 }
553 if(fileL !="./") { 555 if(fileL !="./" && fi->exists()) {
554 item= new QListViewItem( ListView,fileL,fileS , fileDate); 556 item= new QListViewItem( Local_View,fileL,fileS , fileDate);
555 QPixmap pm; 557 QPixmap pm;
556 pm= Resource::loadPixmap( "folder" );
557 558
558 if(isDir || fileL.find("/",0,TRUE) != -1) { 559 if(isDir || fileL.find("/",0,TRUE) != -1) {
559 if( !QDir( fi->filePath() ).isReadable()) 560 if( !QDir( fi->filePath() ).isReadable())
560 pm = Resource::loadPixmap( "lockedfolder" ); 561 pm = Resource::loadPixmap( "lockedfolder" );
562 else
563 pm= Resource::loadPixmap( "folder" );
561 item->setPixmap( 0,pm ); 564 item->setPixmap( 0,pm );
562 } else { 565 } else {
563 if( !fi->isReadable() ) 566 if( !fi->isReadable() )
564 pm = Resource::loadPixmap( "locked" ); 567 pm = Resource::loadPixmap( "locked" );
565 else 568 else {
566 pm = Resource::loadPixmap( "fileopen" ); 569 MimeType mt(fi->filePath());
570 pm=mt.pixmap();
571 if(pm.isNull())
572 pm = Resource::loadPixmap( "UnknownDocument-14" );
567 item->setPixmap( 0,pm); 573 item->setPixmap( 0,pm);
568 } 574 }
575 }
569 if( fileL.find("->",0,TRUE) != -1) { 576 if( fileL.find("->",0,TRUE) != -1) {
570 // overlay link image 577 // overlay link image
578 pm= Resource::loadPixmap( "folder" );
571 QPixmap lnk = Resource::loadPixmap( "symlink" ); 579 QPixmap lnk = Resource::loadPixmap( "symlink" );
572 QPainter painter( &pm ); 580 QPainter painter( &pm );
573 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 581 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
574 pm.setMask( pm.createHeuristicMask( FALSE ) ); 582 pm.setMask( pm.createHeuristicMask( FALSE ) );
575 item->setPixmap( 0, pm); 583 item->setPixmap( 0, pm);
576 } 584 }
577 } 585 }
578 isDir=FALSE; 586 isDir=FALSE;
579 ++it; 587 ++it;
580 } 588 }
581 Local_View->setSorting( 3,FALSE); 589 Local_View->setSorting( 3,FALSE);
582 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 590 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
@@ -631,24 +639,25 @@ bool OpieFtp::populateRemoteView( )
631 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 639 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
632 file.close(); 640 file.close();
633 if( file.exists()) 641 if( file.exists())
634 file. remove(); 642 file. remove();
635 } else 643 } else
636 qDebug("temp file not opened successfullly "+sfile); 644 qDebug("temp file not opened successfullly "+sfile);
637 Remote_View->setSorting( 4,TRUE); 645 Remote_View->setSorting( 4,TRUE);
638 return true; 646 return true;
639} 647}
640 648
641void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 649void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
642{ 650{
651 if(item) {
643 QCopEnvelope ( "QPE/System", "busy()" ); 652 QCopEnvelope ( "QPE/System", "busy()" );
644 QString oldRemoteCurrentDir = currentRemoteDir; 653 QString oldRemoteCurrentDir = currentRemoteDir;
645 QString strItem=selectedItem->text(0); 654 QString strItem=selectedItem->text(0);
646 strItem=strItem.simplifyWhiteSpace(); 655 strItem=strItem.simplifyWhiteSpace();
647 if(strItem == "../") { // the user wants to go ^ 656 if(strItem == "../") { // the user wants to go ^
648 if( FtpCDUp( conn) == 0) { 657 if( FtpCDUp( conn) == 0) {
649 QString msg; 658 QString msg;
650 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 659 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
651 msg.replace(QRegExp(":"),"\n"); 660 msg.replace(QRegExp(":"),"\n");
652 QMessageBox::message(tr("Note"),msg); 661 QMessageBox::message(tr("Note"),msg);
653 qDebug(msg); 662 qDebug(msg);
654 } 663 }
@@ -683,27 +692,29 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
683 } 692 }
684 } else { 693 } else {
685 qDebug("download "+strItem); 694 qDebug("download "+strItem);
686 } 695 }
687 } 696 }
688 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 697 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
689 if(currentRemoteDir.right(1) !="/") 698 if(currentRemoteDir.right(1) !="/")
690 currentRemoteDir +="/"; 699 currentRemoteDir +="/";
691 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 700 currentPathCombo->lineEdit()->setText( currentRemoteDir );
692 fillRemoteCombo( (const QString &)currentDir); 701 fillRemoteCombo( (const QString &)currentDir);
693 QCopEnvelope ( "QPE/System", "notBusy()" ); 702 QCopEnvelope ( "QPE/System", "notBusy()" );
694} 703}
704}
695 705
696void OpieFtp::localListClicked(QListViewItem *selectedItem) 706void OpieFtp::localListClicked(QListViewItem *selectedItem)
697{ 707{
708 if(item) {
698 QString strItem=selectedItem->text(0); 709 QString strItem=selectedItem->text(0);
699 QString strSize=selectedItem->text(1); 710 QString strSize=selectedItem->text(1);
700 strSize=strSize.stripWhiteSpace(); 711 strSize=strSize.stripWhiteSpace();
701 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 712 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
702 // is symlink 713 // is symlink
703 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 714 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
704 if(QDir(strItem2).exists() ) { 715 if(QDir(strItem2).exists() ) {
705 currentDir.cd(strItem2, TRUE); 716 currentDir.cd(strItem2, TRUE);
706 populateLocalView(); 717 populateLocalView();
707 } 718 }
708 } else { // not a symlink 719 } else { // not a symlink
709 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 720 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
@@ -719,24 +730,25 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
719 currentDir.cd(strItem, TRUE); 730 currentDir.cd(strItem, TRUE);
720 populateLocalView(); 731 populateLocalView();
721 } 732 }
722 } else { 733 } else {
723 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 734 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
724 if( QFile::exists(strItem ) ) { 735 if( QFile::exists(strItem ) ) {
725 qDebug("upload "+strItem); 736 qDebug("upload "+strItem);
726 } 737 }
727 } //end not symlink 738 } //end not symlink
728 chdir(strItem.latin1()); 739 chdir(strItem.latin1());
729 } 740 }
730} 741}
742}
731 743
732void OpieFtp::doLocalCd() 744void OpieFtp::doLocalCd()
733{ 745{
734 localListClicked( Local_View->currentItem()); 746 localListClicked( Local_View->currentItem());
735} 747}
736 748
737void OpieFtp:: doRemoteCd() 749void OpieFtp:: doRemoteCd()
738{ 750{
739 remoteListClicked( Remote_View->currentItem()); 751 remoteListClicked( Remote_View->currentItem());
740 752
741} 753}
742 754
@@ -955,58 +967,58 @@ void OpieFtp::localRename()
955 QString oldname = currentDir.canonicalPath() + "/" + curFile; 967 QString oldname = currentDir.canonicalPath() + "/" + curFile;
956 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 968 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
957 if( rename(oldname.latin1(), newName.latin1())== -1) 969 if( rename(oldname.latin1(), newName.latin1())== -1)
958 QMessageBox::message(tr("Note"),tr("Could not rename")); 970 QMessageBox::message(tr("Note"),tr("Could not rename"));
959 } 971 }
960 populateLocalView(); 972 populateLocalView();
961} 973}
962 974
963void OpieFtp::currentPathComboActivated(const QString & currentPath) { 975void OpieFtp::currentPathComboActivated(const QString & currentPath) {
964 if (TabWidget->currentPageIndex() == 0) { 976 if (TabWidget->currentPageIndex() == 0) {
965 chdir( currentPath.latin1() ); 977 chdir( currentPath.latin1() );
966 currentDir.cd( currentPath, TRUE); 978 currentDir.cd( currentPath, TRUE);
967 populateLocalList(); 979 populateLocalView();
968 update(); 980 update();
969 } else { 981 } else {
970// chdir( currentPath.latin1() ); 982// chdir( currentPath.latin1() );
971// currentDir.cd( currentPath, TRUE); 983// currentDir.cd( currentPath, TRUE);
972// populateList(); 984// populateList();
973// update(); 985// update();
974 986
975 } 987 }
976} 988}
977 989
978void OpieFtp::fillCombo(const QString &currentPath) { 990void OpieFtp::fillCombo(const QString &currentPath) {
979 991
980 currentPathComboBox->lineEdit()->setText(currentPath); 992 currentPathCombo->lineEdit()->setText(currentPath);
981 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 993 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
982 currentPathComboBox->clear(); 994 currentPathCombo->clear();
983 localDirPathStringList.prepend(currentPath ); 995 localDirPathStringList.prepend(currentPath );
984 currentPathComboBox->insertStringList( localDirPathStringList,-1); 996 currentPathCombo->insertStringList( localDirPathStringList,-1);
985 } 997 }
986 currentPathComboBox->lineEdit()->setText(currentPath); 998 currentPathCombo->lineEdit()->setText(currentPath);
987 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 999 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
988 currentPathComboBox->clear(); 1000 currentPathCombo->clear();
989 remoteDirPathStringList.prepend(currentPath ); 1001 remoteDirPathStringList.prepend(currentPath );
990 currentPathComboBox->insertStringList( remoteDirPathStringList,-1); 1002 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
991 } 1003 }
992} 1004}
993 1005
994void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1006void OpieFtp::fillRemoteCombo(const QString &currentPath) {
995 1007
996 dirPathCombo->lineEdit()->setText(currentPath); 1008 currentPathCombo->lineEdit()->setText(currentPath);
997 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1009 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
998 dirPathCombo->clear(); 1010 currentPathCombo->clear();
999 remoteDirPathStringList.prepend(currentPath ); 1011 remoteDirPathStringList.prepend(currentPath );
1000 dirPathCombo->insertStringList( remoteDirPathStringList,-1); 1012 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1001 } 1013 }
1002} 1014}
1003 1015
1004void OpieFtp::currentPathComboChanged() 1016void OpieFtp::currentPathComboChanged()
1005{ 1017{
1006 QString oldRemoteCurrentDir = currentRemoteDir; 1018 QString oldRemoteCurrentDir = currentRemoteDir;
1007// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1019// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
1008 if (TabWidget->currentPageIndex() == 0) { 1020 if (TabWidget->currentPageIndex() == 0) {
1009 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1021 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1010 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1022 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1011 populateLocalView(); 1023 populateLocalView();
1012 } else { 1024 } else {
@@ -1118,25 +1130,25 @@ void OpieFtp::fillCombos()
1118void OpieFtp::serverComboSelected(int index) 1130void OpieFtp::serverComboSelected(int index)
1119{ 1131{
1120 currentServerConfig = index; 1132 currentServerConfig = index;
1121 QString username, remoteServerStr, remotePathStr, password, port, temp; 1133 QString username, remoteServerStr, remotePathStr, password, port, temp;
1122// remoteServerStr = ServerComboBox->text(index); 1134// remoteServerStr = ServerComboBox->text(index);
1123 Config cfg("opieftp"); 1135 Config cfg("opieftp");
1124 cfg.setGroup("Server"); 1136 cfg.setGroup("Server");
1125 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1137 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1126 1138
1127 temp.setNum(index+1); 1139 temp.setNum(index+1);
1128 remoteServerStr = cfg.readEntry( temp,""); 1140 remoteServerStr = cfg.readEntry( temp,"");
1129 cfg.setGroup(temp); 1141 cfg.setGroup(temp);
1130 qDebug(temp); 1142// qDebug(temp);
1131 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1143 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1132 port = remoteServerStr.right( divider - 1); 1144 port = remoteServerStr.right( divider - 1);
1133 bool ok; 1145 bool ok;
1134 int portInt = port.toInt(&ok,10); 1146 int portInt = port.toInt(&ok,10);
1135 if( portInt == 0) portInt = 21; 1147 if( portInt == 0) portInt = 21;
1136 1148
1137 PortSpinBox->setValue( portInt); 1149 PortSpinBox->setValue( portInt);
1138 1150
1139 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1151 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1140 1152
1141 username = cfg.readEntry("Username", "anonymous"); 1153 username = cfg.readEntry("Username", "anonymous");
1142 UsernameComboBox->lineEdit()->setText(username); 1154 UsernameComboBox->lineEdit()->setText(username);
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 57599b7..32862c7 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -43,25 +43,25 @@ class OpieFtp : public QMainWindow
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46public: 46public:
47 OpieFtp( ); 47 OpieFtp( );
48 ~OpieFtp(); 48 ~OpieFtp();
49 49
50 QTabWidget *TabWidget; 50 QTabWidget *TabWidget;
51 QWidget *tab, *tab_2, *tab_3; 51 QWidget *tab, *tab_2, *tab_3;
52 QListView *Local_View, *Remote_View; 52 QListView *Local_View, *Remote_View;
53 53
54 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; 54 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
55 QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; 55 QLineEdit *PasswordEdit, *remotePath;
56 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 56 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
57 QSpinBox* PortSpinBox; 57 QSpinBox* PortSpinBox;
58 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; 58 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu;
59 QDir currentDir; 59 QDir currentDir;
60 QString currentRemoteDir; 60 QString currentRemoteDir;
61 QString filterStr; 61 QString filterStr;
62 QListViewItem * item; 62 QListViewItem * item;
63 QPushButton *connectServerBtn; 63 QPushButton *connectServerBtn;
64 bool b; 64 bool b;
65 int currentServerConfig; 65 int currentServerConfig;
66protected slots: 66protected slots:
67 void serverComboEdited(const QString & ); 67 void serverComboEdited(const QString & );
@@ -85,32 +85,31 @@ protected slots:
85 void RemoteListPressed( int, QListViewItem *, const QPoint&, int); 85 void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
86 void localMakDir(); 86 void localMakDir();
87 void localDelete(); 87 void localDelete();
88 void remoteMakDir(); 88 void remoteMakDir();
89 void remoteDelete(); 89 void remoteDelete();
90 bool remoteDirList(const QString &); 90 bool remoteDirList(const QString &);
91 bool remoteChDir(const QString &); 91 bool remoteChDir(const QString &);
92 void tabChanged(QWidget*); 92 void tabChanged(QWidget*);
93 void cleanUp(); 93 void cleanUp();
94 void remoteRename(); 94 void remoteRename();
95 void localRename(); 95 void localRename();
96 void currentPathComboChanged(); 96 void currentPathComboChanged();
97 void fillCombos();
98 void fillCombo(const QString &);
99 void currentPathComboActivated(const QString &); 97 void currentPathComboActivated(const QString &);
100 void switchToLocalTab(); 98 void switchToLocalTab();
101 void switchToRemoteTab(); 99 void switchToRemoteTab();
102 void switchToConfigTab(); 100 void switchToConfigTab();
103 void fillCombo(); 101 void fillCombos();
104 void fillRemoteCombo(); 102 void fillRemoteCombo(const QString&);
103 void fillCombo(const QString &);
105 void serverComboSelected(int); 104 void serverComboSelected(int);
106 void deleteServer(); 105 void deleteServer();
107 void connectorBtnToggled(bool); 106 void connectorBtnToggled(bool);
108protected: 107protected:
109 QStringList remoteDirPathStringList, localDirPathStringList; 108 QStringList remoteDirPathStringList, localDirPathStringList;
110 void nullifyCallBack(); 109 void nullifyCallBack();
111 QGridLayout* tabLayout; 110 QGridLayout* tabLayout;
112 QGridLayout* tabLayout_2; 111 QGridLayout* tabLayout_2;
113 QGridLayout* tabLayout_3; 112 QGridLayout* tabLayout_3;
114 113
115}; 114};
116 115