Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
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 | |||
@@ -36,73 +36,73 @@ extern "C" { | |||
36 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
37 | #include <qlayout.h> | 37 | #include <qlayout.h> |
38 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qlistbox.h> | 40 | #include <qlistbox.h> |
41 | 41 | ||
42 | #include <unistd.h> | 42 | #include <unistd.h> |
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | 44 | ||
45 | 45 | ||
46 | QProgressBar *ProgressBar; | 46 | QProgressBar *ProgressBar; |
47 | static netbuf *conn=NULL; | 47 | static netbuf *conn=NULL; |
48 | 48 | ||
49 | static int log_progress(netbuf *, int xfered, void *) | 49 | static 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 | ||
60 | OpieFtp::OpieFtp( ) | 60 | OpieFtp::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() )); |
97 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 97 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
98 | 98 | ||
99 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 99 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
100 | localMenu->insertSeparator(); | 100 | localMenu->insertSeparator(); |
101 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 101 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
102 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 102 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
103 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 103 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
104 | localMenu->insertSeparator(); | 104 | localMenu->insertSeparator(); |
105 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 105 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
106 | localMenu->setCheckable(TRUE); | 106 | localMenu->setCheckable(TRUE); |
107 | 107 | ||
108 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 108 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
@@ -248,137 +248,137 @@ OpieFtp::OpieFtp( ) | |||
248 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, | 248 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, |
249 | SLOT(serverComboEdited(const QString & ) )); | 249 | SLOT(serverComboEdited(const QString & ) )); |
250 | 250 | ||
251 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 251 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
252 | TextLabel5->setText( tr( "Remote path" ) ); | 252 | TextLabel5->setText( tr( "Remote path" ) ); |
253 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 253 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
254 | 254 | ||
255 | 255 | ||
256 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 256 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
257 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 257 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
258 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 258 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
259 | TextLabel4->setText( tr( "Port" ) ); | 259 | TextLabel4->setText( tr( "Port" ) ); |
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*))); |
296 | 296 | ||
297 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 297 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
298 | currentDir.setPath( QDir::currentDirPath()); | 298 | currentDir.setPath( QDir::currentDirPath()); |
299 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 299 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
300 | 300 | ||
301 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 301 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
302 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 302 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
303 | currentPathCombo ->setFixedWidth(220); | 303 | currentPathCombo ->setFixedWidth(220); |
304 | currentPathCombo->setEditable(TRUE); | 304 | currentPathCombo->setEditable(TRUE); |
305 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 305 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
306 | 306 | ||
307 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 307 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
308 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 308 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
309 | 309 | ||
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 | ||
326 | OpieFtp::~OpieFtp() | 326 | OpieFtp::~OpieFtp() |
327 | { | 327 | { |
328 | } | 328 | } |
329 | 329 | ||
330 | void OpieFtp::cleanUp() | 330 | void 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(); |
335 | if(sfile.right(1) != "/") | 335 | if(sfile.right(1) != "/") |
336 | sfile+="/._temp"; | 336 | sfile+="/._temp"; |
337 | else | 337 | else |
338 | sfile+="._temp"; | 338 | sfile+="._temp"; |
339 | QFile file( sfile); | 339 | QFile file( sfile); |
340 | if(file.exists()) | 340 | if(file.exists()) |
341 | file.remove(); | 341 | file.remove(); |
342 | Config cfg("opieftp"); | 342 | Config cfg("opieftp"); |
343 | cfg.setGroup("Server"); | 343 | cfg.setGroup("Server"); |
344 | cfg.writeEntry("currentServer", currentServerConfig); | 344 | cfg.writeEntry("currentServer", currentServerConfig); |
345 | 345 | ||
346 | exit(0); | 346 | exit(0); |
347 | } | 347 | } |
348 | 348 | ||
349 | void OpieFtp::tabChanged(QWidget *) | 349 | void 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) { |
373 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 373 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
374 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 374 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
375 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 375 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
376 | cdUpButton->hide(); | 376 | cdUpButton->hide(); |
377 | homeButton->hide(); | 377 | homeButton->hide(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | void OpieFtp::newConnection() | 381 | void OpieFtp::newConnection() |
382 | { | 382 | { |
383 | UsernameComboBox->lineEdit()->setText(""); | 383 | UsernameComboBox->lineEdit()->setText(""); |
384 | PasswordEdit->setText( "" ); | 384 | PasswordEdit->setText( "" ); |
@@ -428,49 +428,49 @@ void OpieFtp::connector() | |||
428 | connectServerBtn->setOn(FALSE); | 428 | connectServerBtn->setOn(FALSE); |
429 | connectServerBtn->setText( tr("Connect")); | 429 | connectServerBtn->setText( tr("Connect")); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | 432 | ||
433 | FtpInit(); | 433 | FtpInit(); |
434 | 434 | ||
435 | TabWidget->setCurrentPage(1); | 435 | TabWidget->setCurrentPage(1); |
436 | QString ftp_host = ServerComboBox->currentText(); | 436 | QString ftp_host = ServerComboBox->currentText(); |
437 | QString ftp_user = UsernameComboBox->currentText(); | 437 | QString ftp_user = UsernameComboBox->currentText(); |
438 | QString ftp_pass = PasswordEdit->text(); | 438 | QString ftp_pass = PasswordEdit->text(); |
439 | QString port=PortSpinBox->cleanText(); | 439 | QString port=PortSpinBox->cleanText(); |
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 | } |
465 | 465 | ||
466 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 466 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
467 | QString msg; | 467 | QString msg; |
468 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 468 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
469 | msg.replace(QRegExp(":"),"\n"); | 469 | msg.replace(QRegExp(":"),"\n"); |
470 | QMessageBox::message(tr("Note"),msg); | 470 | QMessageBox::message(tr("Note"),msg); |
471 | if(conn) | 471 | if(conn) |
472 | FtpQuit(conn); | 472 | FtpQuit(conn); |
473 | connectServerBtn->setOn(FALSE); | 473 | connectServerBtn->setOn(FALSE); |
474 | connectServerBtn->setText( tr("Connect")); | 474 | connectServerBtn->setText( tr("Connect")); |
475 | return ; | 475 | return ; |
476 | } | 476 | } |
@@ -572,49 +572,49 @@ void OpieFtp::remoteDownload() | |||
572 | QString temp; | 572 | QString temp; |
573 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 573 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
574 | 574 | ||
575 | ProgressBar->setTotalSteps(fsz); | 575 | ProgressBar->setTotalSteps(fsz); |
576 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 576 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
577 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 577 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
578 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 578 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
579 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 579 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
580 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 580 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
581 | 581 | ||
582 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 582 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
583 | QString msg; | 583 | QString msg; |
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 | ||
602 | bool OpieFtp::remoteDirList(const QString &dir) | 602 | bool 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"; |
609 | // qDebug("Listing remote dir "+tmp); | 609 | // qDebug("Listing remote dir "+tmp); |
610 | // QCopEnvelope ( "QPE/System", "busy()" ); | 610 | // QCopEnvelope ( "QPE/System", "busy()" ); |
611 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 611 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
612 | QString msg; | 612 | QString msg; |
613 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 613 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
614 | msg.replace(QRegExp(":"),"\n"); | 614 | msg.replace(QRegExp(":"),"\n"); |
615 | QMessageBox::message(tr("Note"),msg); | 615 | QMessageBox::message(tr("Note"),msg); |
616 | return false; | 616 | return false; |
617 | } | 617 | } |
618 | populateRemoteView() ; | 618 | populateRemoteView() ; |
619 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 619 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
620 | return true; | 620 | return true; |
@@ -648,49 +648,49 @@ void OpieFtp::populateLocalView() | |||
648 | QFileInfoListIterator it(*list); | 648 | QFileInfoListIterator it(*list); |
649 | QFileInfo *fi; | 649 | QFileInfo *fi; |
650 | while ( (fi=it.current()) ) { | 650 | while ( (fi=it.current()) ) { |
651 | if (fi->isSymLink() ){ | 651 | if (fi->isSymLink() ){ |
652 | QString symLink=fi->readLink(); | 652 | QString symLink=fi->readLink(); |
653 | // qDebug("Symlink detected "+symLink); | 653 | // qDebug("Symlink detected "+symLink); |
654 | QFileInfo sym( symLink); | 654 | QFileInfo sym( symLink); |
655 | fileS.sprintf( "%10i", sym.size() ); | 655 | fileS.sprintf( "%10i", sym.size() ); |
656 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 656 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
657 | fileDate = sym.lastModified().toString(); | 657 | fileDate = sym.lastModified().toString(); |
658 | } else { | 658 | } else { |
659 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 659 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
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 |
685 | if(pm.isNull()) | 685 | if(pm.isNull()) |
686 | pm = unknownXpm; | 686 | pm = unknownXpm; |
687 | } | 687 | } |
688 | } | 688 | } |
689 | if( fileL.find("->",0,TRUE) != -1) { | 689 | if( fileL.find("->",0,TRUE) != -1) { |
690 | // overlay link image | 690 | // overlay link image |
691 | pm= Resource::loadPixmap( "folder" ); | 691 | pm= Resource::loadPixmap( "folder" ); |
692 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 692 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
693 | QPainter painter( &pm ); | 693 | QPainter painter( &pm ); |
694 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 694 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
695 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 695 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
696 | } | 696 | } |
@@ -708,49 +708,49 @@ bool OpieFtp::populateRemoteView( ) | |||
708 | { | 708 | { |
709 | // qDebug("populate remoteview"); | 709 | // qDebug("populate remoteview"); |
710 | QString sfile=QDir::homeDirPath(); | 710 | QString sfile=QDir::homeDirPath(); |
711 | if(sfile.right(1) != "/") | 711 | if(sfile.right(1) != "/") |
712 | sfile+="/._temp"; | 712 | sfile+="/._temp"; |
713 | else | 713 | else |
714 | sfile+="._temp"; | 714 | sfile+="._temp"; |
715 | QFile file( sfile); | 715 | QFile file( sfile); |
716 | Remote_View->clear(); | 716 | Remote_View->clear(); |
717 | QString s, File_Name; | 717 | QString s, File_Name; |
718 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 718 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
719 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | 719 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); |
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"); |
745 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 745 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
746 | // if(itemFile) | 746 | // if(itemFile) |
747 | item->moveItem(itemDir); | 747 | item->moveItem(itemDir); |
748 | item->moveItem(itemFile); | 748 | item->moveItem(itemFile); |
749 | itemFile=item; | 749 | itemFile=item; |
750 | } | 750 | } |
751 | } | 751 | } |
752 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 752 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
753 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 753 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
754 | file.close(); | 754 | file.close(); |
755 | if( file.exists()) | 755 | if( file.exists()) |
756 | file. remove(); | 756 | file. remove(); |
@@ -794,92 +794,92 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
794 | currentRemoteDir = oldRemoteCurrentDir; | 794 | currentRemoteDir = oldRemoteCurrentDir; |
795 | strItem=""; | 795 | strItem=""; |
796 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 796 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
797 | } | 797 | } |
798 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 798 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
799 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 799 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
800 | currentRemoteDir = oldRemoteCurrentDir; | 800 | currentRemoteDir = oldRemoteCurrentDir; |
801 | strItem=""; | 801 | strItem=""; |
802 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 802 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
803 | 803 | ||
804 | } else { | 804 | } else { |
805 | currentRemoteDir = currentRemoteDir+strItem; | 805 | currentRemoteDir = currentRemoteDir+strItem; |
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 | ||
823 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 823 | void 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 | ||
865 | void OpieFtp::doLocalCd() | 865 | void OpieFtp::doLocalCd() |
866 | { | 866 | { |
867 | localListClicked( Local_View->currentItem()); | 867 | localListClicked( Local_View->currentItem()); |
868 | } | 868 | } |
869 | 869 | ||
870 | void OpieFtp:: doRemoteCd() | 870 | void OpieFtp:: doRemoteCd() |
871 | { | 871 | { |
872 | remoteListClicked( Remote_View->currentItem()); | 872 | remoteListClicked( Remote_View->currentItem()); |
873 | 873 | ||
874 | } | 874 | } |
875 | 875 | ||
876 | void OpieFtp::showHidden() | 876 | void OpieFtp::showHidden() |
877 | { | 877 | { |
878 | if (!b) { | 878 | if (!b) { |
879 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 879 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
880 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 880 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
881 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 881 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
882 | b=TRUE; | 882 | b=TRUE; |
883 | 883 | ||
884 | } else { | 884 | } else { |
885 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 885 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
@@ -951,82 +951,82 @@ void OpieFtp::showLocalMenu(QListViewItem * item) | |||
951 | m->exec( QCursor::pos() ); | 951 | m->exec( QCursor::pos() ); |
952 | delete m; | 952 | delete m; |
953 | } | 953 | } |
954 | 954 | ||
955 | void OpieFtp::localMakDir() | 955 | void OpieFtp::localMakDir() |
956 | { | 956 | { |
957 | InputDialog *fileDlg; | 957 | InputDialog *fileDlg; |
958 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 958 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
959 | fileDlg->exec(); | 959 | fileDlg->exec(); |
960 | if( fileDlg->result() == 1 ) { | 960 | if( fileDlg->result() == 1 ) { |
961 | QString filename = fileDlg->LineEdit1->text(); | 961 | QString filename = fileDlg->LineEdit1->text(); |
962 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 962 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
963 | } | 963 | } |
964 | populateLocalView(); | 964 | populateLocalView(); |
965 | } | 965 | } |
966 | 966 | ||
967 | void OpieFtp::localDelete() | 967 | void 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 | ||
1011 | void OpieFtp::remoteMakDir() | 1011 | void 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) { |
1021 | QString msg; | 1021 | QString msg; |
1022 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 1022 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
1023 | msg.replace(QRegExp(":"),"\n"); | 1023 | msg.replace(QRegExp(":"),"\n"); |
1024 | QMessageBox::message(tr("Note"),msg); | 1024 | QMessageBox::message(tr("Note"),msg); |
1025 | } | 1025 | } |
1026 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 1026 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
1027 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1027 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | void OpieFtp::remoteDelete() | 1031 | void OpieFtp::remoteDelete() |
1032 | { | 1032 | { |
@@ -1180,52 +1180,52 @@ void OpieFtp::currentPathComboChanged() | |||
1180 | } | 1180 | } |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | void OpieFtp::switchToLocalTab() | 1183 | void OpieFtp::switchToLocalTab() |
1184 | { | 1184 | { |
1185 | TabWidget->setCurrentPage(0); | 1185 | TabWidget->setCurrentPage(0); |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | void OpieFtp::switchToRemoteTab() | 1188 | void OpieFtp::switchToRemoteTab() |
1189 | { | 1189 | { |
1190 | TabWidget->setCurrentPage(1); | 1190 | TabWidget->setCurrentPage(1); |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | void OpieFtp::switchToConfigTab() | 1193 | void OpieFtp::switchToConfigTab() |
1194 | { | 1194 | { |
1195 | TabWidget->setCurrentPage(2); | 1195 | TabWidget->setCurrentPage(2); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | void OpieFtp::readConfig() | 1198 | void 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 | ||
1210 | void OpieFtp::writeConfig() | 1210 | void 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 | ||
1220 | if( currentServerConfig == -1) { | 1220 | if( currentServerConfig == -1) { |
1221 | 1221 | ||
1222 | for (int i = 1; i <= numberOfEntries; i++) { | 1222 | for (int i = 1; i <= numberOfEntries; i++) { |
1223 | temp.setNum(i); | 1223 | temp.setNum(i); |
1224 | cfg.setGroup("Server"); | 1224 | cfg.setGroup("Server"); |
1225 | QString tempStr = cfg.readEntry( temp,""); | 1225 | QString tempStr = cfg.readEntry( temp,""); |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | temp.setNum( numberOfEntries + 1); | 1228 | temp.setNum( numberOfEntries + 1); |
1229 | cfg.setGroup("Server"); | 1229 | cfg.setGroup("Server"); |
1230 | 1230 | ||
1231 | remoteServerStr = cfg.readEntry( temp,""); | 1231 | remoteServerStr = cfg.readEntry( temp,""); |
@@ -1233,49 +1233,49 @@ void OpieFtp::writeConfig() | |||
1233 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1233 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1234 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1234 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1235 | 1235 | ||
1236 | temp.setNum(numberOfEntries+1); | 1236 | temp.setNum(numberOfEntries+1); |
1237 | cfg.setGroup("Server"); | 1237 | cfg.setGroup("Server"); |
1238 | 1238 | ||
1239 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1239 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
1240 | cfg.writeEntry("currentServer", numberOfEntries+1); | 1240 | cfg.writeEntry("currentServer", numberOfEntries+1); |
1241 | 1241 | ||
1242 | currentServerConfig = numberOfEntries+1; | 1242 | currentServerConfig = numberOfEntries+1; |
1243 | qDebug("setting currentserverconfig to %d", currentServerConfig); | 1243 | qDebug("setting currentserverconfig to %d", currentServerConfig); |
1244 | 1244 | ||
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 | ||
1261 | void OpieFtp::clearCombos() { | 1261 | void 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 | ||
1270 | void OpieFtp::fillCombos() | 1270 | void OpieFtp::fillCombos() |
1271 | { | 1271 | { |
1272 | clearCombos(); | 1272 | clearCombos(); |
1273 | 1273 | ||
1274 | Config cfg("opieftp"); | 1274 | Config cfg("opieftp"); |
1275 | cfg.setGroup("Server"); | 1275 | cfg.setGroup("Server"); |
1276 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1276 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1277 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1277 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1278 | 1278 | ||
1279 | for (int i = 1; i <= numberOfEntries; i++) { | 1279 | for (int i = 1; i <= numberOfEntries; i++) { |
1280 | temp.setNum(i); | 1280 | temp.setNum(i); |
1281 | qDebug(temp); | 1281 | qDebug(temp); |
@@ -1305,81 +1305,81 @@ void OpieFtp::fillCombos() | |||
1305 | 1305 | ||
1306 | 1306 | ||
1307 | void OpieFtp::serverComboSelected(int index) | 1307 | void OpieFtp::serverComboSelected(int index) |
1308 | { | 1308 | { |
1309 | currentServerConfig = index+1; | 1309 | currentServerConfig = index+1; |
1310 | qDebug("server combo selected %d", index+1); | 1310 | qDebug("server combo selected %d", index+1); |
1311 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1311 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1312 | // remoteServerStr = ServerComboBox->text(index); | 1312 | // remoteServerStr = ServerComboBox->text(index); |
1313 | 1313 | ||
1314 | Config cfg("opieftp"); | 1314 | Config cfg("opieftp"); |
1315 | cfg.setGroup("Server"); | 1315 | cfg.setGroup("Server"); |
1316 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1316 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
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 | ||
1355 | void OpieFtp::deleteServer() | 1355 | void 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 ) { |
1374 | // servername.find( cfg.readEntry("ServerName")) != -1 && | 1374 | // servername.find( cfg.readEntry("ServerName")) != -1 && |
1375 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && | 1375 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && |
1376 | // username.find( cfg.readEntry("Username")) != -1) { | 1376 | // username.find( cfg.readEntry("Username")) != -1) { |
1377 | 1377 | ||
1378 | serverListView->removeItem(i); | 1378 | serverListView->removeItem(i); |
1379 | 1379 | ||
1380 | qDebug("OK DELETE "+tempname); | 1380 | qDebug("OK DELETE "+tempname); |
1381 | cfg.removeEntry(QString::number(i)); | 1381 | cfg.removeEntry(QString::number(i)); |
1382 | for ( ; i <= numberOfEntries; i++) { | 1382 | for ( ; i <= numberOfEntries; i++) { |
1383 | cfg.setGroup("Server"); | 1383 | cfg.setGroup("Server"); |
1384 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); | 1384 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); |
1385 | 1385 | ||
@@ -1472,44 +1472,44 @@ void OpieFtp::homeButtonPushed() { | |||
1472 | void OpieFtp::doAbout() { | 1472 | void OpieFtp::doAbout() { |
1473 | QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" | 1473 | QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" |
1474 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1474 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1475 | "and uses ftplib copyright 1996-2000\n" | 1475 | "and uses ftplib copyright 1996-2000\n" |
1476 | "by Thomas Pfau, pfau@cnj.digex.net\n\n" | 1476 | "by Thomas Pfau, pfau@cnj.digex.net\n\n" |
1477 | "and is licensed by the GPL"); | 1477 | "and is licensed by the GPL"); |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | void OpieFtp::NewServer() { | 1480 | void OpieFtp::NewServer() { |
1481 | InputDialog *fileDlg; | 1481 | InputDialog *fileDlg; |
1482 | fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); | 1482 | fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); |
1483 | fileDlg->exec(); | 1483 | fileDlg->exec(); |
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 | ||
1501 | void OpieFtp::serverListClicked( const QString &item) { | 1501 | void 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) |
1509 | serverComboSelected(i-1); | 1509 | serverComboSelected(i-1); |
1510 | } | 1510 | } |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | void OpieFtp::timerOut() { | 1513 | void OpieFtp::timerOut() { |
1514 | 1514 | ||
1515 | } | 1515 | } |