author | llornkcor <llornkcor> | 2004-07-07 21:11:13 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-07 21:11:13 (UTC) |
commit | debb74bbf33b42d1ad38f4437cf9ad054978d71b (patch) (unidiff) | |
tree | cc34b697970b78c5573700057088b18c53e3c781 | |
parent | 8ff360bd5e136aba5a9c1b340040ecaf0fc6e0d4 (diff) | |
download | opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.zip opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.tar.gz opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.tar.bz2 |
hide path combo if on config tab
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 58ffe3a..b703217 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -178,402 +178,405 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
178 | 178 | ||
179 | tabLayout->addWidget( Local_View, 0, 0 ); | 179 | tabLayout->addWidget( Local_View, 0, 0 ); |
180 | 180 | ||
181 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 181 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
182 | this,SLOT( localListClicked(QListViewItem*)) ); | 182 | this,SLOT( localListClicked(QListViewItem*)) ); |
183 | // connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), | 183 | // connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), |
184 | // this,SLOT( localListClicked(QListViewItem*)) ); | 184 | // this,SLOT( localListClicked(QListViewItem*)) ); |
185 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 185 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
186 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 186 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
187 | 187 | ||
188 | TabWidget->insertTab( tab, tr( "Local" ) ); | 188 | TabWidget->insertTab( tab, tr( "Local" ) ); |
189 | 189 | ||
190 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 190 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
191 | tabLayout_2 = new QGridLayout( tab_2 ); | 191 | tabLayout_2 = new QGridLayout( tab_2 ); |
192 | tabLayout_2->setSpacing( 2); | 192 | tabLayout_2->setSpacing( 2); |
193 | tabLayout_2->setMargin( 2); | 193 | tabLayout_2->setMargin( 2); |
194 | 194 | ||
195 | Remote_View = new QListView( tab_2, "Remote_View" ); | 195 | Remote_View = new QListView( tab_2, "Remote_View" ); |
196 | Remote_View->addColumn( tr("File"),150); | 196 | Remote_View->addColumn( tr("File"),150); |
197 | Remote_View->addColumn( tr("Date"),-1); | 197 | Remote_View->addColumn( tr("Date"),-1); |
198 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); | 198 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
199 | Remote_View->addColumn( tr("Size"),-1); | 199 | Remote_View->addColumn( tr("Size"),-1); |
200 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 200 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
201 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | 201 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); |
202 | Remote_View->addColumn( tr("Dir"),-1); | 202 | Remote_View->addColumn( tr("Dir"),-1); |
203 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 203 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
204 | Remote_View->setAllColumnsShowFocus(TRUE); | 204 | Remote_View->setAllColumnsShowFocus(TRUE); |
205 | 205 | ||
206 | Remote_View->setMultiSelection( FALSE); | 206 | Remote_View->setMultiSelection( FALSE); |
207 | Remote_View->setSelectionMode(QListView::Extended); | 207 | Remote_View->setSelectionMode(QListView::Extended); |
208 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 208 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
209 | 209 | ||
210 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 210 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
211 | 211 | ||
212 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | 212 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
213 | this,SLOT( remoteListClicked(QListViewItem*)) ); | 213 | this,SLOT( remoteListClicked(QListViewItem*)) ); |
214 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 214 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
215 | this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); | 215 | this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); |
216 | 216 | ||
217 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 217 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
218 | 218 | ||
219 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 219 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
220 | 220 | ||
221 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 221 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
222 | tabLayout_3 = new QGridLayout( tab_3 ); | 222 | tabLayout_3 = new QGridLayout( tab_3 ); |
223 | tabLayout_3->setSpacing( 2); | 223 | tabLayout_3->setSpacing( 2); |
224 | tabLayout_3->setMargin( 2); | 224 | tabLayout_3->setMargin( 2); |
225 | 225 | ||
226 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 226 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
227 | TextLabel1->setText( tr( "Username" ) ); | 227 | TextLabel1->setText( tr( "Username" ) ); |
228 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 228 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
229 | 229 | ||
230 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 230 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
231 | UsernameComboBox->setEditable(TRUE); | 231 | UsernameComboBox->setEditable(TRUE); |
232 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 232 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
233 | 233 | ||
234 | connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, | 234 | connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, |
235 | SLOT( UsernameComboBoxEdited(const QString&) )); | 235 | SLOT( UsernameComboBoxEdited(const QString&) )); |
236 | 236 | ||
237 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 237 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
238 | TextLabel2->setText( tr( "Password" ) ); | 238 | TextLabel2->setText( tr( "Password" ) ); |
239 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 239 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
240 | 240 | ||
241 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 241 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
242 | PasswordEdit->setEchoMode(QLineEdit::Password); | 242 | PasswordEdit->setEchoMode(QLineEdit::Password); |
243 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 243 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
244 | 244 | ||
245 | connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, | 245 | connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, |
246 | SLOT( PasswordEditEdited(const QString&) )); | 246 | SLOT( PasswordEditEdited(const QString&) )); |
247 | 247 | ||
248 | //PasswordEdit->setFixedWidth(85); | 248 | //PasswordEdit->setFixedWidth(85); |
249 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 249 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
250 | TextLabel3->setText( tr( "Remote server" ) ); | 250 | TextLabel3->setText( tr( "Remote server" ) ); |
251 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 251 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
252 | 252 | ||
253 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 253 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
254 | ServerComboBox->setEditable(TRUE); | 254 | ServerComboBox->setEditable(TRUE); |
255 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 255 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
256 | 256 | ||
257 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); | 257 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); |
258 | connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, | 258 | connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, |
259 | SLOT(serverComboEdited(const QString&) )); | 259 | SLOT(serverComboEdited(const QString&) )); |
260 | 260 | ||
261 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 261 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
262 | TextLabel5->setText( tr( "Remote path" ) ); | 262 | TextLabel5->setText( tr( "Remote path" ) ); |
263 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 263 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
264 | 264 | ||
265 | 265 | ||
266 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 266 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
267 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 267 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
268 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 268 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
269 | TextLabel4->setText( tr( "Port" ) ); | 269 | TextLabel4->setText( tr( "Port" ) ); |
270 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 270 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
271 | 271 | ||
272 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 272 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
273 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 273 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
274 | PortSpinBox->setMaxValue(32786); | 274 | PortSpinBox->setMaxValue(32786); |
275 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 275 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
276 | 276 | ||
277 | serverListView = new QListBox( tab_3, "ServerListView" ); | 277 | serverListView = new QListBox( tab_3, "ServerListView" ); |
278 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 278 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
279 | 279 | ||
280 | connect( serverListView, SIGNAL( highlighted(const QString&)), | 280 | connect( serverListView, SIGNAL( highlighted(const QString&)), |
281 | this,SLOT( serverListClicked(const QString&) ) ); | 281 | this,SLOT( serverListClicked(const QString&) ) ); |
282 | 282 | ||
283 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); | 283 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); |
284 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 284 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
285 | connectServerBtn->setToggleButton(TRUE); | 285 | connectServerBtn->setToggleButton(TRUE); |
286 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); | 286 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); |
287 | 287 | ||
288 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); | 288 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); |
289 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 289 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
290 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 290 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
291 | 291 | ||
292 | QPushButton *deleteServerBtn; | 292 | QPushButton *deleteServerBtn; |
293 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); | 293 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); |
294 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 294 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
295 | 295 | ||
296 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 296 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
297 | 297 | ||
298 | 298 | ||
299 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 299 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
300 | tabLayout_3->addItem( spacer, 5, 0 ); | 300 | tabLayout_3->addItem( spacer, 5, 0 ); |
301 | 301 | ||
302 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 302 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
303 | 303 | ||
304 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), | 304 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), |
305 | this,SLOT(tabChanged(QWidget*))); | 305 | this,SLOT(tabChanged(QWidget*))); |
306 | 306 | ||
307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
308 | currentDir.setPath( QDir::currentDirPath()); | 308 | currentDir.setPath( QDir::currentDirPath()); |
309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
310 | 310 | ||
311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); | 311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); |
312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
313 | currentPathCombo ->setFixedWidth(220); | 313 | currentPathCombo ->setFixedWidth(220); |
314 | currentPathCombo->setEditable(TRUE); | 314 | currentPathCombo->setEditable(TRUE); |
315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
316 | 316 | ||
317 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 317 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
318 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 318 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
319 | 319 | ||
320 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 320 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
321 | this,SLOT(currentPathComboChanged())); | 321 | this,SLOT(currentPathComboChanged())); |
322 | ProgressBar = new QProgressBar( view, "ProgressBar" ); | 322 | ProgressBar = new QProgressBar( view, "ProgressBar" ); |
323 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 323 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
324 | ProgressBar->setMaximumHeight(10); | 324 | ProgressBar->setMaximumHeight(10); |
325 | filterStr="*"; | 325 | filterStr="*"; |
326 | b=FALSE; | 326 | b=FALSE; |
327 | populateLocalView(); | 327 | populateLocalView(); |
328 | readConfig(); | 328 | readConfig(); |
329 | 329 | ||
330 | // ServerComboBox->setCurrentItem(currentServerConfig); | 330 | // ServerComboBox->setCurrentItem(currentServerConfig); |
331 | 331 | ||
332 | TabWidget->setCurrentPage(2); | 332 | TabWidget->setCurrentPage(2); |
333 | odebug << "Constructor done" << oendl; | 333 | odebug << "Constructor done" << oendl; |
334 | } | 334 | } |
335 | 335 | ||
336 | OpieFtp::~OpieFtp() | 336 | OpieFtp::~OpieFtp() |
337 | { | 337 | { |
338 | } | 338 | } |
339 | 339 | ||
340 | void OpieFtp::cleanUp() | 340 | void OpieFtp::cleanUp() |
341 | { | 341 | { |
342 | if(conn) | 342 | if(conn) |
343 | FtpQuit(conn); | 343 | FtpQuit(conn); |
344 | QString sfile=QDir::homeDirPath(); | 344 | QString sfile=QDir::homeDirPath(); |
345 | if(sfile.right(1) != "/") | 345 | if(sfile.right(1) != "/") |
346 | sfile+="/._temp"; | 346 | sfile+="/._temp"; |
347 | else | 347 | else |
348 | sfile+="._temp"; | 348 | sfile+="._temp"; |
349 | QFile file( sfile); | 349 | QFile file( sfile); |
350 | if(file.exists()) | 350 | if(file.exists()) |
351 | file.remove(); | 351 | file.remove(); |
352 | Config cfg("opieftp"); | 352 | Config cfg("opieftp"); |
353 | cfg.setGroup("Server"); | 353 | cfg.setGroup("Server"); |
354 | cfg.writeEntry("currentServer", currentServerConfig); | 354 | cfg.writeEntry("currentServer", currentServerConfig); |
355 | 355 | ||
356 | exit(0); | 356 | exit(0); |
357 | } | 357 | } |
358 | 358 | ||
359 | void OpieFtp::tabChanged(QWidget *) | 359 | void OpieFtp::tabChanged(QWidget *) |
360 | { | 360 | { |
361 | if (TabWidget->currentPageIndex() == 0) { | 361 | if (TabWidget->currentPageIndex() == 0) { |
362 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 362 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
363 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 363 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
364 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 364 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
365 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 365 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
366 | if(cdUpButton->isHidden()) | 366 | if(cdUpButton->isHidden()) |
367 | cdUpButton->show(); | 367 | cdUpButton->show(); |
368 | if(homeButton->isHidden()) | 368 | if(homeButton->isHidden()) |
369 | homeButton->show(); | 369 | homeButton->show(); |
370 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | ||
370 | 371 | ||
371 | } | 372 | } |
372 | if (TabWidget->currentPageIndex() == 1) { | 373 | if (TabWidget->currentPageIndex() == 1) { |
373 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 374 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
374 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 375 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
375 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 376 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
376 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 377 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
377 | if(cdUpButton->isHidden()) | 378 | if(cdUpButton->isHidden()) |
378 | cdUpButton->show(); | 379 | cdUpButton->show(); |
379 | homeButton->hide(); | 380 | homeButton->hide(); |
381 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | ||
380 | 382 | ||
381 | } | 383 | } |
382 | if (TabWidget->currentPageIndex() == 2) { | 384 | if (TabWidget->currentPageIndex() == 2) { |
383 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 385 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
384 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 386 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
385 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 387 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
386 | cdUpButton->hide(); | 388 | cdUpButton->hide(); |
387 | homeButton->hide(); | 389 | homeButton->hide(); |
390 | if(!currentPathCombo->isHidden()) currentPathCombo->hide(); | ||
388 | } | 391 | } |
389 | } | 392 | } |
390 | 393 | ||
391 | void OpieFtp::newConnection() | 394 | void OpieFtp::newConnection() |
392 | { | 395 | { |
393 | UsernameComboBox->lineEdit()->setText(""); | 396 | UsernameComboBox->lineEdit()->setText(""); |
394 | PasswordEdit->setText( "" ); | 397 | PasswordEdit->setText( "" ); |
395 | ServerComboBox->lineEdit()->setText( ""); | 398 | ServerComboBox->lineEdit()->setText( ""); |
396 | remotePath->setText( currentRemoteDir = "/"); | 399 | remotePath->setText( currentRemoteDir = "/"); |
397 | PortSpinBox->setValue( 21); | 400 | PortSpinBox->setValue( 21); |
398 | TabWidget->setCurrentPage(2); | 401 | TabWidget->setCurrentPage(2); |
399 | } | 402 | } |
400 | 403 | ||
401 | void OpieFtp::serverComboEdited(const QString & ) | 404 | void OpieFtp::serverComboEdited(const QString & ) |
402 | { | 405 | { |
403 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 406 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
404 | // odebug << "ServerComboEdited" << oendl; | 407 | // odebug << "ServerComboEdited" << oendl; |
405 | // // currentServerConfig = -1; | 408 | // // currentServerConfig = -1; |
406 | // } | 409 | // } |
407 | } | 410 | } |
408 | 411 | ||
409 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 412 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
410 | // currentServerConfig = -1; | 413 | // currentServerConfig = -1; |
411 | } | 414 | } |
412 | 415 | ||
413 | void OpieFtp::PasswordEditEdited(const QString & ) { | 416 | void OpieFtp::PasswordEditEdited(const QString & ) { |
414 | // currentServerConfig = -1; | 417 | // currentServerConfig = -1; |
415 | } | 418 | } |
416 | 419 | ||
417 | void OpieFtp::connectorBtnToggled(bool On) | 420 | void OpieFtp::connectorBtnToggled(bool On) |
418 | { | 421 | { |
419 | if(On) { | 422 | if(On) { |
420 | connector(); | 423 | connector(); |
421 | } else { | 424 | } else { |
422 | disConnector(); | 425 | disConnector(); |
423 | } | 426 | } |
424 | 427 | ||
425 | } | 428 | } |
426 | 429 | ||
427 | void OpieFtp::connector() | 430 | void OpieFtp::connector() |
428 | { | 431 | { |
429 | // QCopEnvelope ( "QPE/System", "busy()" ); | 432 | // QCopEnvelope ( "QPE/System", "busy()" ); |
430 | // qApp->processEvents(); | 433 | // qApp->processEvents(); |
431 | currentRemoteDir=remotePath->text(); | 434 | currentRemoteDir=remotePath->text(); |
432 | 435 | ||
433 | if( ServerComboBox->currentText().isEmpty()) { | 436 | if( ServerComboBox->currentText().isEmpty()) { |
434 | 437 | ||
435 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 438 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
436 | TabWidget->setCurrentPage(2); | 439 | TabWidget->setCurrentPage(2); |
437 | ServerComboBox->setFocus(); | 440 | ServerComboBox->setFocus(); |
438 | connectServerBtn->setOn(FALSE); | 441 | connectServerBtn->setOn(FALSE); |
439 | connectServerBtn->setText( tr("Connect")); | 442 | connectServerBtn->setText( tr("Connect")); |
440 | return; | 443 | return; |
441 | } | 444 | } |
442 | 445 | ||
443 | FtpInit(); | 446 | FtpInit(); |
444 | 447 | ||
445 | TabWidget->setCurrentPage(1); | 448 | TabWidget->setCurrentPage(1); |
446 | QString ftp_host = ServerComboBox->currentText(); | 449 | QString ftp_host = ServerComboBox->currentText(); |
447 | QString ftp_user = UsernameComboBox->currentText(); | 450 | QString ftp_user = UsernameComboBox->currentText(); |
448 | QString ftp_pass = PasswordEdit->text(); | 451 | QString ftp_pass = PasswordEdit->text(); |
449 | QString port=PortSpinBox->cleanText(); | 452 | QString port=PortSpinBox->cleanText(); |
450 | port.stripWhiteSpace(); | 453 | port.stripWhiteSpace(); |
451 | 454 | ||
452 | Config cfg("opieftp"); | 455 | Config cfg("opieftp"); |
453 | cfg.setGroup("Server"); | 456 | cfg.setGroup("Server"); |
454 | // int current=cfg.readNumEntry("currentServer", 1); | 457 | // int current=cfg.readNumEntry("currentServer", 1); |
455 | 458 | ||
456 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | 459 | // if(ftp_host!= cfg.readEntry(QString::number( current))) |
457 | // currentServerConfig=-1; | 460 | // currentServerConfig=-1; |
458 | // cfg.setGroup(QString::number(current)); | 461 | // cfg.setGroup(QString::number(current)); |
459 | // if( ftp_user != cfg.readEntry("Username")) | 462 | // if( ftp_user != cfg.readEntry("Username")) |
460 | // currentServerConfig=-1; | 463 | // currentServerConfig=-1; |
461 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) | 464 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) |
462 | // currentServerConfig=-1; | 465 | // currentServerConfig=-1; |
463 | 466 | ||
464 | 467 | ||
465 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 468 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
466 | ftp_host=ftp_host.right(ftp_host.length()-6); | 469 | ftp_host=ftp_host.right(ftp_host.length()-6); |
467 | ftp_host+=":"+port; | 470 | ftp_host+=":"+port; |
468 | 471 | ||
469 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 472 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
470 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 473 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
471 | connectServerBtn->setOn(FALSE); | 474 | connectServerBtn->setOn(FALSE); |
472 | connectServerBtn->setText( tr("Connect")); | 475 | connectServerBtn->setText( tr("Connect")); |
473 | return ; | 476 | return ; |
474 | } | 477 | } |
475 | 478 | ||
476 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 479 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
477 | QString msg; | 480 | QString msg; |
478 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 481 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
479 | msg.replace(QRegExp(":"),"\n"); | 482 | msg.replace(QRegExp(":"),"\n"); |
480 | QMessageBox::message(tr("Note"),msg); | 483 | QMessageBox::message(tr("Note"),msg); |
481 | if(conn) | 484 | if(conn) |
482 | FtpQuit(conn); | 485 | FtpQuit(conn); |
483 | connectServerBtn->setOn(FALSE); | 486 | connectServerBtn->setOn(FALSE); |
484 | connectServerBtn->setText( tr("Connect")); | 487 | connectServerBtn->setText( tr("Connect")); |
485 | return ; | 488 | return ; |
486 | } | 489 | } |
487 | 490 | ||
488 | remoteDirList("/") ; | 491 | remoteDirList("/") ; |
489 | setCaption(ftp_host); | 492 | setCaption(ftp_host); |
490 | if( currentServerConfig == -1) | 493 | if( currentServerConfig == -1) |
491 | writeConfig(); | 494 | writeConfig(); |
492 | connectServerBtn->setText( tr("Disconnect")); | 495 | connectServerBtn->setText( tr("Disconnect")); |
493 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 496 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
494 | } | 497 | } |
495 | 498 | ||
496 | void OpieFtp::disConnector() | 499 | void OpieFtp::disConnector() |
497 | { | 500 | { |
498 | if(conn) | 501 | if(conn) |
499 | FtpQuit(conn); | 502 | FtpQuit(conn); |
500 | setCaption("OpieFtp"); | 503 | setCaption("OpieFtp"); |
501 | currentRemoteDir="/"; | 504 | currentRemoteDir="/"; |
502 | Remote_View->clear(); | 505 | Remote_View->clear(); |
503 | connectServerBtn->setText( tr("Connect")); | 506 | connectServerBtn->setText( tr("Connect")); |
504 | connectServerBtn->setOn(FALSE); | 507 | connectServerBtn->setOn(FALSE); |
505 | setCaption("OpieFtp"); | 508 | setCaption("OpieFtp"); |
506 | } | 509 | } |
507 | 510 | ||
508 | void OpieFtp::localUpload() | 511 | void OpieFtp::localUpload() |
509 | { | 512 | { |
510 | int fsz; | 513 | int fsz; |
511 | // QCopEnvelope ( "QPE/System", "busy()" ); | 514 | // QCopEnvelope ( "QPE/System", "busy()" ); |
512 | // qApp->processEvents(); | 515 | // qApp->processEvents(); |
513 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 516 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
514 | QListViewItemIterator it( Local_View ); | 517 | QListViewItemIterator it( Local_View ); |
515 | for ( ; it.current(); ++it ) { | 518 | for ( ; it.current(); ++it ) { |
516 | if ( it.current()->isSelected() ) { | 519 | if ( it.current()->isSelected() ) { |
517 | QString strItem = it.current()->text(0); | 520 | QString strItem = it.current()->text(0); |
518 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 521 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
519 | QString remoteFile= currentRemoteDir+strItem; | 522 | QString remoteFile= currentRemoteDir+strItem; |
520 | QFileInfo fi(localFile); | 523 | QFileInfo fi(localFile); |
521 | if( !fi.isDir()) { | 524 | if( !fi.isDir()) { |
522 | fsz=fi.size(); | 525 | fsz=fi.size(); |
523 | ProgressBar->setTotalSteps(fsz); | 526 | ProgressBar->setTotalSteps(fsz); |
524 | 527 | ||
525 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 528 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
526 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 529 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
527 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 530 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
528 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 531 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
529 | odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; | 532 | odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
530 | 533 | ||
531 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 534 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
532 | QString msg; | 535 | QString msg; |
533 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 536 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
534 | msg.replace(QRegExp(":"),"\n"); | 537 | msg.replace(QRegExp(":"),"\n"); |
535 | QMessageBox::message(tr("Note"),msg); | 538 | QMessageBox::message(tr("Note"),msg); |
536 | } | 539 | } |
537 | } else { | 540 | } else { |
538 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 541 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
539 | } | 542 | } |
540 | ProgressBar->reset(); | 543 | ProgressBar->reset(); |
541 | nullifyCallBack(); | 544 | nullifyCallBack(); |
542 | it.current()->setSelected(FALSE); | 545 | it.current()->setSelected(FALSE); |
543 | } //end currentSelected | 546 | } //end currentSelected |
544 | } | 547 | } |
545 | for ( ; it.current(); ++it ) { | 548 | for ( ; it.current(); ++it ) { |
546 | Local_View->clearSelection(); | 549 | Local_View->clearSelection(); |
547 | } | 550 | } |
548 | Local_View->clearFocus(); | 551 | Local_View->clearFocus(); |
549 | TabWidget->setCurrentPage(1); | 552 | TabWidget->setCurrentPage(1); |
550 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 553 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
551 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 554 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
552 | } | 555 | } |
553 | 556 | ||
554 | void OpieFtp::nullifyCallBack() | 557 | void OpieFtp::nullifyCallBack() |
555 | { | 558 | { |
556 | FtpOptions(FTPLIB_CALLBACK, 0, conn); | 559 | FtpOptions(FTPLIB_CALLBACK, 0, conn); |
557 | FtpOptions(FTPLIB_IDLETIME, 0, conn); | 560 | FtpOptions(FTPLIB_IDLETIME, 0, conn); |
558 | FtpOptions(FTPLIB_CALLBACKARG, 0, conn); | 561 | FtpOptions(FTPLIB_CALLBACKARG, 0, conn); |
559 | FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); | 562 | FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); |
560 | } | 563 | } |
561 | 564 | ||
562 | void OpieFtp::remoteDownload() | 565 | void OpieFtp::remoteDownload() |
563 | { | 566 | { |
564 | // qApp->processEvents(); | 567 | // qApp->processEvents(); |
565 | int fsz; | 568 | int fsz; |
566 | // QCopEnvelope ( "QPE/System", "busy()" ); | 569 | // QCopEnvelope ( "QPE/System", "busy()" ); |
567 | 570 | ||
568 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 571 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
569 | QListViewItemIterator it( Remote_View ); | 572 | QListViewItemIterator it( Remote_View ); |
570 | for ( ; it.current(); ++it ) { | 573 | for ( ; it.current(); ++it ) { |
571 | if ( it.current()->isSelected() ) { | 574 | if ( it.current()->isSelected() ) { |
572 | QString strItem = it.current()->text(0); | 575 | QString strItem = it.current()->text(0); |
573 | // strItem=strItem.right(strItem.length()-1); | 576 | // strItem=strItem.right(strItem.length()-1); |
574 | QString localFile = currentDir.canonicalPath(); | 577 | QString localFile = currentDir.canonicalPath(); |
575 | if(localFile.right(1).find("/",0,TRUE) == -1) | 578 | if(localFile.right(1).find("/",0,TRUE) == -1) |
576 | localFile += "/"; | 579 | localFile += "/"; |
577 | localFile += strItem; | 580 | localFile += strItem; |
578 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 581 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
579 | QString remoteFile= currentRemoteDir+strItem; | 582 | QString remoteFile= currentRemoteDir+strItem; |