summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp/opieftp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 4064549..4c39569 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -83,333 +83,333 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
matrix.scale( .4, .4);
unknownXpm = pix.xForm(matrix);
connectionMenu = new QPopupMenu( this );
localMenu = new QPopupMenu( this );
remoteMenu = new QPopupMenu( this );
tabMenu = new QPopupMenu( this );
//#if 0
layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
//#endif
menuBar->insertItem( tr( "Connection" ), connectionMenu);
// menuBar->insertItem( tr( "Local" ), localMenu);
// menuBar->insertItem( tr( "Remote" ), remoteMenu);
menuBar->insertItem( tr( "View" ), tabMenu);
tabMenu->insertItem( tr( "Local" ), localMenu);
tabMenu->insertItem( tr( "Remote" ), remoteMenu);
connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
localMenu->setCheckable(TRUE);
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->insertSeparator();
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->insertSeparator();
// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
tabMenu->setCheckable(TRUE);
cdUpButton = new QToolButton( view,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
cdUpButton->hide();
// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
// docButton->setFixedSize( QSize( 20, 20 ) );
// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
// docButton->setFlat(TRUE);
// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
homeButton = new QToolButton(view,"homeButton");
homeButton->setPixmap( Resource::loadPixmap("home"));
homeButton->setFixedSize( QSize( 20, 20 ) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
homeButton->hide();
TabWidget = new QTabWidget( view, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
// 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( tr("File"),150);
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(1,QListView::AlignRight);
Local_View->addColumn( tr("Size"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE);
Local_View->setSelectionMode(QListView::Extended);
Local_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
- connect( Local_View, SIGNAL( clicked( QListViewItem*)),
- this,SLOT( localListClicked(QListViewItem *)) );
-// 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)) );
+ connect( Local_View, SIGNAL( clicked(QListViewItem*)),
+ this,SLOT( localListClicked(QListViewItem*)) );
+// 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( tr("File"),150);
Remote_View->addColumn( tr("Date"),-1);
// Remote_View->setColumnAlignment(1,QListView::AlignRight);
Remote_View->addColumn( tr("Size"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setColumnAlignment(3,QListView::AlignCenter);
Remote_View->addColumn( tr("Dir"),-1);
Remote_View->setColumnAlignment(4,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( FALSE);
Remote_View->setSelectionMode(QListView::Extended);
Remote_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
- connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
- this,SLOT( remoteListClicked(QListViewItem *)) );
- connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
- this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
+ connect( Remote_View, SIGNAL( clicked(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);
tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
- connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,
- SLOT( UsernameComboBoxEdited(const QString & ) ));
+ connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this,
+ SLOT( UsernameComboBoxEdited(const QString&) ));
TextLabel2 = new QLabel( tab_3, "TextLabel2" );
TextLabel2->setText( tr( "Password" ) );
tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
PasswordEdit->setEchoMode(QLineEdit::Password);
tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
- connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,
- SLOT( PasswordEditEdited(const QString & ) ));
+ connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this,
+ SLOT( PasswordEditEdited(const QString&) ));
//PasswordEdit->setFixedWidth(85);
TextLabel3 = new QLabel( tab_3, "TextLabel3" );
TextLabel3->setText( tr( "Remote server" ) );
tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
ServerComboBox->setEditable(TRUE);
tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
- connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
- connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,
- SLOT(serverComboEdited(const QString & ) ));
+ connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) ));
+ connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this,
+ SLOT(serverComboEdited(const QString&) ));
QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
TextLabel5->setText( tr( "Remote path" ) );
tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
TextLabel4 = new QLabel( tab_3, "TextLabel4" );
TextLabel4->setText( tr( "Port" ) );
tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
PortSpinBox->setMaxValue(32786);
tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
serverListView = new QListBox( tab_3, "ServerListView" );
tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
- connect( serverListView, SIGNAL( highlighted( const QString &)),
- this,SLOT( serverListClicked( const QString &) ) );
+ connect( serverListView, SIGNAL( highlighted(const QString&)),
+ this,SLOT( serverListClicked(const QString&) ) );
connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
connectServerBtn->setToggleButton(TRUE);
- connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
+ connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) ));
newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
QPushButton *deleteServerBtn;
deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
tabLayout_3->addItem( spacer, 5, 0 );
TabWidget->insertTab( tab_3, tr( "Config" ) );
#if 0
- connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
+ connect(TabWidget,SIGNAL(currentChanged(QWidget*)),
this,SLOT(tabChanged(QWidget*)));
#endif
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
currentDir.setPath( QDir::currentDirPath());
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" );
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
currentPathCombo ->setFixedWidth(220);
currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
#if 0
- connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
- this, SLOT( currentPathComboActivated( const QString & ) ) );
+ connect( currentPathCombo, SIGNAL( activated(const QString&) ),
+ this, SLOT( currentPathComboActivated(const QString&) ) );
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
#endif
ProgressBar = new QProgressBar( view, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
ProgressBar->setMaximumHeight(10);
filterStr="*";
b=FALSE;
#if 0
populateLocalView();
#endif
readConfig();
// ServerComboBox->setCurrentItem(currentServerConfig);
TabWidget->setCurrentPage(2);
qDebug("Constructor done");
}
OpieFtp::~OpieFtp()
{
}
void OpieFtp::cleanUp()
{
if(conn)
FtpQuit(conn);
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
Config cfg("opieftp");
cfg.setGroup("Server");
cfg.writeEntry("currentServer", currentServerConfig);
exit(0);
}
void OpieFtp::tabChanged(QWidget *)
{
if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
if(cdUpButton->isHidden())
cdUpButton->show();
if(homeButton->isHidden())
homeButton->show();
}
if (TabWidget->currentPageIndex() == 1) {
currentPathCombo->lineEdit()->setText( currentRemoteDir );
tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
if(cdUpButton->isHidden())
cdUpButton->show();
homeButton->hide();
}
if (TabWidget->currentPageIndex() == 2) {
tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
cdUpButton->hide();
homeButton->hide();
}
}
void OpieFtp::newConnection()
{
UsernameComboBox->lineEdit()->setText("");
PasswordEdit->setText( "" );
ServerComboBox->lineEdit()->setText( "");
remotePath->setText( currentRemoteDir = "/");
PortSpinBox->setValue( 21);
TabWidget->setCurrentPage(2);
}
void OpieFtp::serverComboEdited(const QString & )
{
// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
// qDebug("ServerComboEdited");
// // currentServerConfig = -1;
// }
}
void OpieFtp::UsernameComboBoxEdited(const QString &) {
// currentServerConfig = -1;
}