author | llornkcor <llornkcor> | 2002-03-28 02:18:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-28 02:18:16 (UTC) |
commit | a2cd4f6515e590ef2e818929843e2923b75beef5 (patch) (unidiff) | |
tree | 918bcd4c46acd2c63ea7fa7ad40c212e1002e457 | |
parent | d360439051f476cd847c4d8cec27a52addcd72a2 (diff) | |
download | opie-a2cd4f6515e590ef2e818929843e2923b75beef5.zip opie-a2cd4f6515e590ef2e818929843e2923b75beef5.tar.gz opie-a2cd4f6515e590ef2e818929843e2923b75beef5.tar.bz2 |
wishy-washy on single vs double click
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 907a812..efcaf84 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -92,122 +92,124 @@ OpieFtp::OpieFtp( ) | |||
92 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 92 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
93 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 93 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
94 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 94 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
95 | 95 | ||
96 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 96 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
97 | localMenu->insertSeparator(); | 97 | localMenu->insertSeparator(); |
98 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 98 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
99 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 99 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
100 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 100 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
101 | localMenu->insertSeparator(); | 101 | localMenu->insertSeparator(); |
102 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 102 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
103 | localMenu->setCheckable(TRUE); | 103 | localMenu->setCheckable(TRUE); |
104 | 104 | ||
105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
106 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 106 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
107 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 107 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
108 | remoteMenu->insertSeparator(); | 108 | remoteMenu->insertSeparator(); |
109 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 109 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
110 | 110 | ||
111 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 111 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
112 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 112 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
113 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 113 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
114 | tabMenu->setCheckable(TRUE); | 114 | tabMenu->setCheckable(TRUE); |
115 | 115 | ||
116 | TabWidget = new QTabWidget( this, "TabWidget" ); | 116 | TabWidget = new QTabWidget( this, "TabWidget" ); |
117 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); | 117 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); |
118 | 118 | ||
119 | TabWidget->setTabShape(QTabWidget::Triangular); | 119 | TabWidget->setTabShape(QTabWidget::Triangular); |
120 | 120 | ||
121 | tab = new QWidget( TabWidget, "tab" ); | 121 | tab = new QWidget( TabWidget, "tab" ); |
122 | tabLayout = new QGridLayout( tab ); | 122 | tabLayout = new QGridLayout( tab ); |
123 | tabLayout->setSpacing( 2); | 123 | tabLayout->setSpacing( 2); |
124 | tabLayout->setMargin( 2); | 124 | tabLayout->setMargin( 2); |
125 | 125 | ||
126 | Local_View = new QListView( tab, "Local_View" ); | 126 | Local_View = new QListView( tab, "Local_View" ); |
127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
128 | Local_View->addColumn( tr("File"),150); | 128 | Local_View->addColumn( tr("File"),150); |
129 | Local_View->addColumn( tr("Size"),-1); | 129 | Local_View->addColumn( tr("Size"),-1); |
130 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 130 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
131 | Local_View->addColumn( tr("Date"),-1); | 131 | Local_View->addColumn( tr("Date"),-1); |
132 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 132 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
133 | Local_View->setAllColumnsShowFocus(TRUE); | 133 | Local_View->setAllColumnsShowFocus(TRUE); |
134 | Local_View->setMultiSelection( TRUE ); | 134 | Local_View->setMultiSelection( TRUE ); |
135 | 135 | ||
136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
137 | 137 | ||
138 | tabLayout->addWidget( Local_View, 0, 0 ); | 138 | tabLayout->addWidget( Local_View, 0, 0 ); |
139 | 139 | ||
140 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 140 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
141 | this,SLOT( localListClicked(QListViewItem *)) ); | 141 | this,SLOT( localListClicked(QListViewItem *)) ); |
142 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | ||
143 | // this,SLOT( localListClicked(QListViewItem *)) ); | ||
142 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 144 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
143 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 145 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
144 | 146 | ||
145 | TabWidget->insertTab( tab, tr( "Local" ) ); | 147 | TabWidget->insertTab( tab, tr( "Local" ) ); |
146 | 148 | ||
147 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 149 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
148 | tabLayout_2 = new QGridLayout( tab_2 ); | 150 | tabLayout_2 = new QGridLayout( tab_2 ); |
149 | tabLayout_2->setSpacing( 2); | 151 | tabLayout_2->setSpacing( 2); |
150 | tabLayout_2->setMargin( 2); | 152 | tabLayout_2->setMargin( 2); |
151 | 153 | ||
152 | Remote_View = new QListView( tab_2, "Remote_View" ); | 154 | Remote_View = new QListView( tab_2, "Remote_View" ); |
153 | Remote_View->addColumn( tr("File"),150); | 155 | Remote_View->addColumn( tr("File"),150); |
154 | Remote_View->addColumn( tr("Size"),-1); | 156 | Remote_View->addColumn( tr("Size"),-1); |
155 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 157 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
156 | Remote_View->addColumn( tr("Date"),-1); | 158 | Remote_View->addColumn( tr("Date"),-1); |
157 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 159 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
158 | Remote_View->addColumn( tr("Dir"),-1); | 160 | Remote_View->addColumn( tr("Dir"),-1); |
159 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 161 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
160 | Remote_View->setAllColumnsShowFocus(TRUE); | 162 | Remote_View->setAllColumnsShowFocus(TRUE); |
161 | Remote_View->setMultiSelection( TRUE ); | 163 | Remote_View->setMultiSelection( TRUE ); |
162 | 164 | ||
163 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 165 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
164 | 166 | ||
165 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), | 167 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
166 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 168 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
167 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 169 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
168 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 170 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
169 | 171 | ||
170 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 172 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
171 | 173 | ||
172 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 174 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
173 | 175 | ||
174 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 176 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
175 | tabLayout_3 = new QGridLayout( tab_3 ); | 177 | tabLayout_3 = new QGridLayout( tab_3 ); |
176 | tabLayout_3->setSpacing( 2); | 178 | tabLayout_3->setSpacing( 2); |
177 | tabLayout_3->setMargin( 2); | 179 | tabLayout_3->setMargin( 2); |
178 | 180 | ||
179 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 181 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
180 | TextLabel1->setText( tr( "Username" ) ); | 182 | TextLabel1->setText( tr( "Username" ) ); |
181 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 183 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
182 | 184 | ||
183 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 185 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
184 | UsernameComboBox->setEditable(TRUE); | 186 | UsernameComboBox->setEditable(TRUE); |
185 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 187 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
186 | 188 | ||
187 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 189 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
188 | TextLabel2->setText( tr( "Password" ) ); | 190 | TextLabel2->setText( tr( "Password" ) ); |
189 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 191 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
190 | 192 | ||
191 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 193 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
192 | PasswordEdit->setEchoMode(QLineEdit::Password); | 194 | PasswordEdit->setEchoMode(QLineEdit::Password); |
193 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 195 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
194 | 196 | ||
195 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 197 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
196 | TextLabel3->setText( tr( "Remote server" ) ); | 198 | TextLabel3->setText( tr( "Remote server" ) ); |
197 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 199 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
198 | 200 | ||
199 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 201 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
200 | ServerComboBox->setEditable(TRUE); | 202 | ServerComboBox->setEditable(TRUE); |
201 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 203 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
202 | 204 | ||
203 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 205 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
204 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 206 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); |
205 | 207 | ||
206 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 208 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
207 | TextLabel5->setText( tr( "Remote path" ) ); | 209 | TextLabel5->setText( tr( "Remote path" ) ); |
208 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 210 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
209 | 211 | ||
210 | 212 | ||
211 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 213 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
212 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 214 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
213 | 215 | ||
@@ -395,151 +397,151 @@ void OpieFtp::connector() | |||
395 | } | 397 | } |
396 | 398 | ||
397 | void OpieFtp::disConnector() | 399 | void OpieFtp::disConnector() |
398 | { | 400 | { |
399 | if(conn) | 401 | if(conn) |
400 | FtpQuit(conn); | 402 | FtpQuit(conn); |
401 | setCaption("OpieFtp"); | 403 | setCaption("OpieFtp"); |
402 | currentRemoteDir="/"; | 404 | currentRemoteDir="/"; |
403 | Remote_View->clear(); | 405 | Remote_View->clear(); |
404 | connectServerBtn->setText( tr("Connect")); | 406 | connectServerBtn->setText( tr("Connect")); |
405 | connectServerBtn->setOn(FALSE); | 407 | connectServerBtn->setOn(FALSE); |
406 | 408 | ||
407 | } | 409 | } |
408 | 410 | ||
409 | void OpieFtp::localUpload() | 411 | void OpieFtp::localUpload() |
410 | { | 412 | { |
411 | int fsz; | 413 | int fsz; |
412 | QCopEnvelope ( "QPE/System", "busy()" ); | 414 | QCopEnvelope ( "QPE/System", "busy()" ); |
413 | // qApp->processEvents(); | 415 | // qApp->processEvents(); |
414 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 416 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
415 | QListViewItemIterator it( Local_View ); | 417 | QListViewItemIterator it( Local_View ); |
416 | for ( ; it.current(); ++it ) { | 418 | for ( ; it.current(); ++it ) { |
417 | if ( it.current()->isSelected() ) { | 419 | if ( it.current()->isSelected() ) { |
418 | QString strItem = it.current()->text(0); | 420 | QString strItem = it.current()->text(0); |
419 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 421 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
420 | QString remoteFile= currentRemoteDir+strItem; | 422 | QString remoteFile= currentRemoteDir+strItem; |
421 | QFileInfo fi(localFile); | 423 | QFileInfo fi(localFile); |
422 | if( !fi.isDir()) { | 424 | if( !fi.isDir()) { |
423 | fsz=fi.size(); | 425 | fsz=fi.size(); |
424 | ProgressBar->setTotalSteps(fsz); | 426 | ProgressBar->setTotalSteps(fsz); |
425 | 427 | ||
426 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 428 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
427 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 429 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
428 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 430 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
429 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 431 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
430 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 432 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
431 | 433 | ||
432 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 434 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
433 | QString msg; | 435 | QString msg; |
434 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 436 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
435 | msg.replace(QRegExp(":"),"\n"); | 437 | msg.replace(QRegExp(":"),"\n"); |
436 | QMessageBox::message(tr("Note"),msg); | 438 | QMessageBox::message(tr("Note"),msg); |
437 | } | 439 | } |
438 | } else { | 440 | } else { |
439 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 441 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
440 | } | 442 | } |
441 | ProgressBar->reset(); | 443 | ProgressBar->reset(); |
442 | nullifyCallBack(); | 444 | nullifyCallBack(); |
443 | it.current()->setSelected(FALSE); | 445 | it.current()->setSelected(FALSE); |
444 | } //end currentSelected | 446 | } //end currentSelected |
445 | } | 447 | } |
446 | TabWidget->setCurrentPage(1); | 448 | TabWidget->setCurrentPage(1); |
447 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 449 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
448 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 450 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
449 | } | 451 | } |
450 | 452 | ||
451 | void OpieFtp::nullifyCallBack() | 453 | void OpieFtp::nullifyCallBack() |
452 | { | 454 | { |
453 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 455 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
454 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 456 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
455 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 457 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
456 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 458 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
457 | } | 459 | } |
458 | 460 | ||
459 | void OpieFtp::remoteDownload() | 461 | void OpieFtp::remoteDownload() |
460 | { | 462 | { |
461 | // qApp->processEvents(); | 463 | // qApp->processEvents(); |
462 | int fsz; | 464 | int fsz; |
463 | QCopEnvelope ( "QPE/System", "busy()" ); | 465 | QCopEnvelope ( "QPE/System", "busy()" ); |
464 | 466 | ||
465 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 467 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
466 | QListViewItemIterator it( Remote_View ); | 468 | QListViewItemIterator it( Remote_View ); |
467 | for ( ; it.current(); ++it ) { | 469 | for ( ; it.current(); ++it ) { |
468 | if ( it.current()->isSelected() ) { | 470 | if ( it.current()->isSelected() ) { |
469 | QString strItem = it.current()->text(0); | 471 | QString strItem = it.current()->text(0); |
470 | // strItem=strItem.right(strItem.length()-1); | 472 | // strItem=strItem.right(strItem.length()-1); |
471 | QString localFile = currentDir.canonicalPath(); | 473 | QString localFile = currentDir.canonicalPath(); |
472 | if(localFile.right(1).find("/",0,TRUE) == -1) | 474 | if(localFile.right(1).find("/",0,TRUE) == -1) |
473 | localFile += "/"; | 475 | localFile += "/"; |
474 | localFile += strItem; | 476 | localFile += strItem; |
475 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 477 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
476 | QString remoteFile= currentRemoteDir+strItem; | 478 | QString remoteFile= currentRemoteDir+strItem; |
477 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 479 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
478 | fsz = 0; | 480 | fsz = 0; |
479 | QString temp; | 481 | QString temp; |
480 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 482 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
481 | 483 | ||
482 | ProgressBar->setTotalSteps(fsz); | 484 | ProgressBar->setTotalSteps(fsz); |
483 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 485 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
484 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 486 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
485 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 487 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
486 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 488 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
487 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 489 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
488 | 490 | ||
489 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 491 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
490 | QString msg; | 492 | QString msg; |
491 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 493 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
492 | msg.replace(QRegExp(":"),"\n"); | 494 | msg.replace(QRegExp(":"),"\n"); |
493 | QMessageBox::message(tr("Note"),msg); | 495 | QMessageBox::message(tr("Note"),msg); |
494 | } | 496 | } |
495 | ProgressBar->reset(); | 497 | ProgressBar->reset(); |
496 | nullifyCallBack(); | 498 | nullifyCallBack(); |
497 | it.current()->setSelected(FALSE); | 499 | it.current()->setSelected(FALSE); |
498 | } | 500 | } |
499 | } | 501 | } |
500 | TabWidget->setCurrentPage(0); | 502 | TabWidget->setCurrentPage(0); |
501 | populateLocalView(); | 503 | populateLocalView(); |
502 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 504 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
503 | } | 505 | } |
504 | 506 | ||
505 | bool OpieFtp::remoteDirList(const QString &dir) | 507 | bool OpieFtp::remoteDirList(const QString &dir) |
506 | { | 508 | { |
507 | QString tmp = QDir::homeDirPath(); | 509 | QString tmp = QDir::homeDirPath(); |
508 | if(tmp.right(1) != "/") | 510 | if(tmp.right(1) != "/") |
509 | tmp+="/._temp"; | 511 | tmp+="/._temp"; |
510 | else | 512 | else |
511 | tmp+="._temp"; | 513 | tmp+="._temp"; |
512 | // qDebug("Listing remote dir "+tmp); | 514 | // qDebug("Listing remote dir "+tmp); |
513 | QCopEnvelope ( "QPE/System", "busy()" ); | 515 | QCopEnvelope ( "QPE/System", "busy()" ); |
514 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 516 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
515 | QString msg; | 517 | QString msg; |
516 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 518 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
517 | msg.replace(QRegExp(":"),"\n"); | 519 | msg.replace(QRegExp(":"),"\n"); |
518 | QMessageBox::message(tr("Note"),msg); | 520 | QMessageBox::message(tr("Note"),msg); |
519 | return false; | 521 | return false; |
520 | } | 522 | } |
521 | populateRemoteView() ; | 523 | populateRemoteView() ; |
522 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 524 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
523 | return true; | 525 | return true; |
524 | } | 526 | } |
525 | 527 | ||
526 | bool OpieFtp::remoteChDir(const QString &dir) | 528 | bool OpieFtp::remoteChDir(const QString &dir) |
527 | { | 529 | { |
528 | QCopEnvelope ( "QPE/System", "busy()" ); | 530 | QCopEnvelope ( "QPE/System", "busy()" ); |
529 | if (!FtpChdir( dir.latin1(), conn )) { | 531 | if (!FtpChdir( dir.latin1(), conn )) { |
530 | QString msg; | 532 | QString msg; |
531 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 533 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
532 | msg.replace(QRegExp(":"),"\n"); | 534 | msg.replace(QRegExp(":"),"\n"); |
533 | QMessageBox::message(tr("Note"),msg); | 535 | QMessageBox::message(tr("Note"),msg); |
534 | qDebug(msg); | 536 | qDebug(msg); |
535 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 537 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
536 | return FALSE; | 538 | return FALSE; |
537 | } | 539 | } |
538 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 540 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
539 | return TRUE; | 541 | return TRUE; |
540 | } | 542 | } |
541 | 543 | ||
542 | void OpieFtp::populateLocalView() | 544 | void OpieFtp::populateLocalView() |
543 | { | 545 | { |
544 | Local_View->clear(); | 546 | Local_View->clear(); |
545 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 547 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
@@ -704,97 +706,97 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
704 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 706 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
705 | 707 | ||
706 | } else { | 708 | } else { |
707 | currentRemoteDir = currentRemoteDir+strItem; | 709 | currentRemoteDir = currentRemoteDir+strItem; |
708 | } | 710 | } |
709 | } else { | 711 | } else { |
710 | qDebug("download "+strItem); | 712 | qDebug("download "+strItem); |
711 | } | 713 | } |
712 | } | 714 | } |
713 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 715 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
714 | if(currentRemoteDir.right(1) !="/") | 716 | if(currentRemoteDir.right(1) !="/") |
715 | currentRemoteDir +="/"; | 717 | currentRemoteDir +="/"; |
716 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 718 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
717 | fillRemoteCombo( (const QString &)currentDir); | 719 | fillRemoteCombo( (const QString &)currentDir); |
718 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 720 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
719 | } | 721 | } |
720 | } | 722 | } |
721 | 723 | ||
722 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 724 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
723 | { | 725 | { |
724 | if(item) { | 726 | if(item) { |
725 | QString strItem=selectedItem->text(0); | 727 | QString strItem=selectedItem->text(0); |
726 | QString strSize=selectedItem->text(1); | 728 | QString strSize=selectedItem->text(1); |
727 | strSize=strSize.stripWhiteSpace(); | 729 | strSize=strSize.stripWhiteSpace(); |
728 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 730 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
729 | // is symlink | 731 | // is symlink |
730 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 732 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
731 | if(QDir(strItem2).exists() ) { | 733 | if(QDir(strItem2).exists() ) { |
732 | currentDir.cd(strItem2, TRUE); | 734 | currentDir.cd(strItem2, TRUE); |
733 | populateLocalView(); | 735 | populateLocalView(); |
734 | } | 736 | } |
735 | } else { // not a symlink | 737 | } else { // not a symlink |
736 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 738 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
737 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 739 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
738 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 740 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
739 | currentDir.cd(strItem,FALSE); | 741 | currentDir.cd(strItem,FALSE); |
740 | populateLocalView(); | 742 | populateLocalView(); |
741 | } else { | 743 | } else { |
742 | currentDir.cdUp(); | 744 | currentDir.cdUp(); |
743 | populateLocalView(); | 745 | populateLocalView(); |
744 | } | 746 | } |
745 | if(QDir(strItem).exists()){ | 747 | if(QDir(strItem).exists()){ |
746 | currentDir.cd(strItem, TRUE); | 748 | currentDir.cd(strItem, TRUE); |
747 | populateLocalView(); | 749 | populateLocalView(); |
748 | } | 750 | } |
749 | } else { | 751 | } else { |
750 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 752 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
751 | if( QFile::exists(strItem ) ) { | 753 | if( QFile::exists(strItem ) ) { |
752 | qDebug("upload "+strItem); | 754 | // qDebug("upload "+strItem); |
753 | } | 755 | } |
754 | } //end not symlink | 756 | } //end not symlink |
755 | chdir(strItem.latin1()); | 757 | chdir(strItem.latin1()); |
756 | } | 758 | } |
757 | } | 759 | } |
758 | } | 760 | } |
759 | 761 | ||
760 | void OpieFtp::doLocalCd() | 762 | void OpieFtp::doLocalCd() |
761 | { | 763 | { |
762 | localListClicked( Local_View->currentItem()); | 764 | localListClicked( Local_View->currentItem()); |
763 | } | 765 | } |
764 | 766 | ||
765 | void OpieFtp:: doRemoteCd() | 767 | void OpieFtp:: doRemoteCd() |
766 | { | 768 | { |
767 | remoteListClicked( Remote_View->currentItem()); | 769 | remoteListClicked( Remote_View->currentItem()); |
768 | 770 | ||
769 | } | 771 | } |
770 | 772 | ||
771 | void OpieFtp::showHidden() | 773 | void OpieFtp::showHidden() |
772 | { | 774 | { |
773 | if (!b) { | 775 | if (!b) { |
774 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 776 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
775 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 777 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
776 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 778 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
777 | b=TRUE; | 779 | b=TRUE; |
778 | 780 | ||
779 | } else { | 781 | } else { |
780 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 782 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
781 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 783 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
782 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 784 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
783 | b=FALSE; | 785 | b=FALSE; |
784 | } | 786 | } |
785 | populateLocalView(); | 787 | populateLocalView(); |
786 | } | 788 | } |
787 | 789 | ||
788 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 790 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
789 | { | 791 | { |
790 | switch (mouse) { | 792 | switch (mouse) { |
791 | case 1: | 793 | case 1: |
792 | break; | 794 | break; |
793 | case 2: | 795 | case 2: |
794 | showLocalMenu(item); | 796 | showLocalMenu(item); |
795 | break; | 797 | break; |
796 | }; | 798 | }; |
797 | } | 799 | } |
798 | 800 | ||
799 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 801 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
800 | { | 802 | { |