-rw-r--r-- | noncore/net/opieftp/inputDialog.cpp | 0 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 90 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.pro | 2 |
3 files changed, 46 insertions, 46 deletions
diff --git a/noncore/net/opieftp/inputDialog.cpp b/noncore/net/opieftp/inputDialog.cpp index 22205d3..89b345e 100644 --- a/noncore/net/opieftp/inputDialog.cpp +++ b/noncore/net/opieftp/inputDialog.cpp diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 814d706..f70011b 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -99,75 +99,75 @@ OpieFtp::OpieFtp( ) remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); remoteMenu->insertSeparator(); remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); tabMenu->setCheckable(TRUE); TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); TabWidget->setTabShape(QTabWidget::Triangular); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); - Local_View->addColumn( "File",120); - Local_View->addColumn( "Size",-1); + Local_View->addColumn( tr("File"),120); + Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(1,QListView::AlignRight); - Local_View->addColumn( "Date",-1); + Local_View->addColumn( tr("Date"),-1); Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); tabLayout->addWidget( Local_View, 0, 0 ); connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), this,SLOT( localListClicked(QListViewItem *)) ); connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); TabWidget->insertTab( tab, tr( "Local" ) ); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing( 2); tabLayout_2->setMargin( 2); Remote_View = new QListView( tab_2, "Remote_View" ); - Remote_View->addColumn( "File",120); - Remote_View->addColumn( "Size",-1); + Remote_View->addColumn( tr("File"),120); + Remote_View->addColumn( tr("Size"),-1); Remote_View->setColumnAlignment(1,QListView::AlignRight); - Remote_View->addColumn( "Date",-1); + Remote_View->addColumn( tr("Date"),-1); Remote_View->setColumnAlignment(2,QListView::AlignRight); Remote_View->setAllColumnsShowFocus(TRUE); QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), this,SLOT( remoteListClicked(QListViewItem *)) ); connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); tabLayout_2->addWidget( Remote_View, 0, 0 ); TabWidget->insertTab( tab_2, tr( "Remote" ) ); tab_3 = new QWidget( TabWidget, "tab_3" ); tabLayout_3 = new QGridLayout( tab_3 ); tabLayout_3->setSpacing( 2); tabLayout_3->setMargin( 2); TextLabel1 = new QLabel( tab_3, "TextLabel1" ); TextLabel1->setText( tr( "Username" ) ); tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); UsernameComboBox->setEditable(TRUE); @@ -281,192 +281,192 @@ void OpieFtp::tabChanged(QWidget *w) } } void OpieFtp::localUpload() { int fsz; QCopEnvelope ( "QPE/System", "busy()" ); qApp->processEvents(); QString strItem = Local_View->currentItem()->text(0); QString localFile = currentDir.canonicalPath()+"/"+strItem; QString remoteFile= currentRemoteDir+strItem; QFileInfo fi(localFile); if( !fi.isDir()) { fsz=fi.size(); ProgressBar->setTotalSteps(fsz); FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { QString msg; - msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); // FtpQuit(conn); } ProgressBar->reset(); nullifyCallBack(); } else { - QMessageBox::message("Note","Cannot upload directories"); + QMessageBox::message(tr("Note"),tr("Cannot upload directories")); } TabWidget->setCurrentPage(1); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::nullifyCallBack() { FtpOptions(FTPLIB_CALLBACK, NULL, conn); FtpOptions(FTPLIB_IDLETIME, NULL, conn); FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); } void OpieFtp::remoteDownload() { int fsz; QCopEnvelope ( "QPE/System", "busy()" ); qApp->processEvents(); QString strItem = Remote_View->currentItem()->text(0); // strItem=strItem.right(strItem.length()-1); QString localFile = currentDir.canonicalPath()+strItem; // QString localFile = currentDir.canonicalPath()+"/"+strItem; QString remoteFile= currentRemoteDir+strItem; if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) fsz = 0; QString temp; temp.sprintf( remoteFile+" "+" %dkb", fsz); ProgressBar->setTotalSteps(fsz); FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { QString msg; - msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); // FtpQuit(conn); } ProgressBar->reset(); nullifyCallBack(); TabWidget->setCurrentPage(0); populateLocalView(); QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::newConnection() { TabWidget->setCurrentPage(2); } void OpieFtp::connector() { QCopEnvelope ( "QPE/System", "busy()" ); qApp->processEvents(); currentRemoteDir=remotePath->text(); if(ServerComboBox->currentText().isEmpty()) { - QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0); + QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); TabWidget->setCurrentPage(2); ServerComboBox->setFocus(); return; } FtpInit(); TabWidget->setCurrentPage(1); QString ftp_host = ServerComboBox->currentText(); QString ftp_user = UsernameComboBox->currentText(); QString ftp_pass = PasswordEdit->text(); QString port=PortSpinBox->cleanText(); port.stripWhiteSpace(); if(ftp_host.find("ftp://",0, TRUE) != -1 ) ftp_host=ftp_host.right(ftp_host.length()-6); ftp_host+=":"+port; if (!FtpConnect( ftp_host.latin1(), &conn)) { - QMessageBox::message("Note","Unable to connect to\n"+ftp_host); + QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); return ; } if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { QString msg; - msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); FtpQuit(conn); return ; } remoteDirList("/") ; setCaption(ftp_host); QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::disConnector() { FtpQuit(conn); setCaption("OpieFtp"); currentRemoteDir="/"; Remote_View->clear(); } bool OpieFtp::remoteDirList(const QString &dir) { QString tmp = QDir::homeDirPath(); if(tmp.right(1) != "/") tmp+="/._temp"; else tmp+="._temp"; // qDebug("Listing remote dir "+tmp); QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { QString msg; - msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); + msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); // FtpQuit(conn); return false; } populateRemoteView() ; QCopEnvelope ( "QPE/System", "notBusy()" ); return true; } bool OpieFtp::remoteChDir(const QString &dir) { QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpChdir( dir.latin1(), conn )) { QString msg; - msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); qDebug(msg); // FtpQuit(conn); QCopEnvelope ( "QPE/System", "notBusy()" ); return FALSE; } QCopEnvelope ( "QPE/System", "notBusy()" ); return TRUE; } void OpieFtp::populateLocalView() { Local_View->clear(); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); QString fileL, fileS, fileDate; bool isDir=FALSE; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ){ QString symLink=fi->readLink(); // qDebug("Symlink detected "+symLink); @@ -540,59 +540,59 @@ bool OpieFtp::populateRemoteView( ) } } } QListViewItem * item1 = new QListViewItem( Remote_View, "../"); item1->setPixmap( 0, Resource::loadPixmap( "folder" )); file.close(); if( file.exists()) file. remove(); } else qDebug("temp file not opened successfullly "+sfile); Remote_View->setSorting( 4,TRUE); return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) { QCopEnvelope ( "QPE/System", "busy()" ); QString oldRemoteCurrentDir = currentRemoteDir; QString strItem=selectedItem->text(0); strItem=strItem.simplifyWhiteSpace(); if(strItem == "../") { // the user wants to go ^ if( FtpCDUp( conn) == 0) { QString msg; - msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); qDebug(msg); } char path[256]; if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string QString msg; - msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); qDebug(msg); } currentRemoteDir=path; } else { if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); strItem = strItem.stripWhiteSpace(); currentRemoteDir = strItem; if( !remoteChDir( (const QString &)strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); } } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory qDebug("trying directory"); if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); } else { currentRemoteDir = currentRemoteDir+strItem; } } else { @@ -710,200 +710,200 @@ void OpieFtp::showLocalMenu(QListViewItem * item) { QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); m.insertSeparator(); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE)) m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); else m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); m.setCheckable(TRUE); if (b) m.setItemChecked(m.idAt(0),TRUE); else m.setItemChecked(m.idAt(0),FALSE); m.exec( QCursor::pos() ); } void OpieFtp::localMakDir() { InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); + fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); } populateLocalView(); } void OpieFtp::localDelete() { QString f = Local_View->currentItem()->text(0); if(QDir(f).exists() ) { - switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ - " ?\nIt must be empty","Yes","No",0,0,1) ) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ + tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=currentDir.canonicalPath()+"/"+f; QString cmd="rmdir "+f; system( cmd.latin1()); populateLocalView(); } break; case 1: // exit break; }; } else { - switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f - +" ?","Yes","No",0,0,1) ) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f + +" ?",tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=currentDir.canonicalPath()+"/"+f; QString cmd="rm "+f; system( cmd.latin1()); populateLocalView(); } break; case 1: // exit break; }; } } void OpieFtp::remoteMakDir() { InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); + fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text();//+".playlist"; QString tmp=currentRemoteDir+filename; QCopEnvelope ( "QPE/System", "busy()" ); if(FtpMkdir( tmp.latin1(), conn) == 0) { QString msg; - msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); } QCopEnvelope ( "QPE/System", "notBusy()" ); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } } void OpieFtp::remoteDelete() { QString f = Remote_View->currentItem()->text(0); QCopEnvelope ( "QPE/System", "busy()" ); if( f.right(1) =="/") { QString path= currentRemoteDir+f; - switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" - ,"Yes","No",0,0,1) ) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" + ,tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=currentDir.canonicalPath()+"/"+f; if(FtpRmdir( path.latin1(), conn) ==0) { QString msg; - msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); } remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } break; }; } else { - switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" - ,"Yes","No",0,0,1) ) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" + ,tr("Yes"),tr("No"),0,0,1) ) { case 0: { QString path= currentRemoteDir+f; if(FtpDelete( path.latin1(), conn)==0) { QString msg; - msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); } remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } break; }; } QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::remoteRename() { QString curFile = Remote_View->currentItem()->text(0); InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Rename",TRUE, 0); + fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); fileDlg->inputText = curFile; fileDlg->exec(); if( fileDlg->result() == 1 ) { QString oldName = currentRemoteDir +"/"+ curFile; QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; QCopEnvelope ( "QPE/System", "busy()" ); if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { QString msg; - msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); + msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); - QMessageBox::message("Note",msg); + QMessageBox::message(tr("Note"),msg); } QCopEnvelope ( "QPE/System", "notBusy()" ); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } } void OpieFtp::localRename() { QString curFile = Local_View->currentItem()->text(0); InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Rename",TRUE, 0); + fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); fileDlg->inputText = curFile; fileDlg->exec(); if( fileDlg->result() == 1 ) { QString oldname = currentDir.canonicalPath() + "/" + curFile; QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; if( rename(oldname.latin1(), newName.latin1())== -1) - QMessageBox::message("Note","Could not rename"); + QMessageBox::message(tr("Note"),tr("Could not rename")); } populateLocalView(); } void OpieFtp::currentPathEditChanged() { QString oldRemoteCurrentDir = currentRemoteDir; // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathEdit->text()).exists()) { currentDir.setPath( currentPathEdit->text() ); populateLocalView(); } else { - QMessageBox::message("Note","That directory does not exist"); + QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } if (TabWidget->currentPageIndex() == 1) { currentRemoteDir = currentPathEdit->text(); if(currentRemoteDir.right(1) !="/") { currentRemoteDir = currentRemoteDir +"/"; currentPathEdit->setText( currentRemoteDir ); } if( !remoteChDir( (const QString &)currentRemoteDir) ) { currentRemoteDir = oldRemoteCurrentDir; currentPathEdit->setText( currentRemoteDir ); } remoteDirList( (const QString &)currentRemoteDir); } } void OpieFtp::switchToLocalTab() { TabWidget->setCurrentPage(0); } void OpieFtp::switchToRemoteTab() { diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index f485cdf..147a8c5 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro @@ -1,12 +1,12 @@ TEMPLATE = app CONFIG += qt warn_on release HEADERS = opieftp.h inputDialog.h ftplib.h SOURCES = opieftp.cpp inputDialog.cpp ftplib.c main.cpp TARGET = opieftp REQUIRES=medium-config DESTDIR = $(OPIEDIR)/bin INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -TRANSLATIONS = ../../i18n/pt_BR/opieftp.ts +TRANSLATIONS += ../../i18n/pt_BR/opieftp.ts |