author | llornkcor <llornkcor> | 2002-03-30 02:04:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-30 02:04:15 (UTC) |
commit | 8c3ddae6102564868c3ae32e337a66dd31c919ac (patch) (unidiff) | |
tree | 83ecb204170b9d8657dbdc04def062fef2760e04 | |
parent | 4fc58d156db9197bc8299f040d4337ea85b9f0d2 (diff) | |
download | opie-8c3ddae6102564868c3ae32e337a66dd31c919ac.zip opie-8c3ddae6102564868c3ae32e337a66dd31c919ac.tar.gz opie-8c3ddae6102564868c3ae32e337a66dd31c919ac.tar.bz2 |
damn spelling error
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 956409f..fce7574 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,356 +1,356 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | //#define DEVELOPERS_VERSION | 12 | //#define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | #include "ftplib.h" | 15 | #include "ftplib.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/mimetype.h> | 24 | #include <qpe/mimetype.h> |
25 | 25 | ||
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qlistview.h> | 36 | #include <qlistview.h> |
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qprogressbar.h> | 39 | #include <qprogressbar.h> |
40 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
41 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
42 | #include <qwidget.h> | 42 | #include <qwidget.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qimage.h> | 44 | #include <qimage.h> |
45 | #include <qpixmap.h> | 45 | #include <qpixmap.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
48 | #include <qregexp.h> | 48 | #include <qregexp.h> |
49 | 49 | ||
50 | #include <unistd.h> | 50 | #include <unistd.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | 53 | ||
54 | QProgressBar *ProgressBar; | 54 | QProgressBar *ProgressBar; |
55 | static netbuf *conn=NULL; | 55 | static netbuf *conn=NULL; |
56 | 56 | ||
57 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 57 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
58 | { | 58 | { |
59 | int fsz = *(int *)arg; | 59 | int fsz = *(int *)arg; |
60 | int pct = (xfered * 100) / fsz; | 60 | int pct = (xfered * 100) / fsz; |
61 | // printf("%3d%%\r", pct); | 61 | // printf("%3d%%\r", pct); |
62 | // fflush(stdout); | 62 | // fflush(stdout); |
63 | ProgressBar->setProgress(xfered); | 63 | ProgressBar->setProgress(xfered); |
64 | qApp->processEvents(); | 64 | qApp->processEvents(); |
65 | return 1; | 65 | return 1; |
66 | } | 66 | } |
67 | 67 | ||
68 | OpieFtp::OpieFtp( ) | 68 | OpieFtp::OpieFtp( ) |
69 | : QMainWindow( ) | 69 | : QMainWindow( ) |
70 | { | 70 | { |
71 | setCaption( tr( "OpieFtp" ) ); | 71 | setCaption( tr( "OpieFtp" ) ); |
72 | 72 | ||
73 | QGridLayout *layout = new QGridLayout( this ); | 73 | QGridLayout *layout = new QGridLayout( this ); |
74 | layout->setSpacing( 2); | 74 | layout->setSpacing( 2); |
75 | layout->setMargin( 2); | 75 | layout->setMargin( 2); |
76 | 76 | ||
77 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 77 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
78 | 78 | ||
79 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 79 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
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, 3 ); | 85 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); |
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 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 92 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
93 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 93 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
94 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 94 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
95 | 95 | ||
96 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 96 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
97 | localMenu->insertSeparator(); | 97 | localMenu->insertSeparator(); |
98 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 98 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
99 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 99 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
100 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 100 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
101 | localMenu->insertSeparator(); | 101 | localMenu->insertSeparator(); |
102 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 102 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
103 | localMenu->setCheckable(TRUE); | 103 | localMenu->setCheckable(TRUE); |
104 | 104 | ||
105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
106 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 106 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
107 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 107 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
108 | remoteMenu->insertSeparator(); | 108 | remoteMenu->insertSeparator(); |
109 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 109 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
110 | 110 | ||
111 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 111 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
112 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 112 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
113 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 113 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
114 | tabMenu->setCheckable(TRUE); | 114 | tabMenu->setCheckable(TRUE); |
115 | 115 | ||
116 | TabWidget = new QTabWidget( this, "TabWidget" ); | 116 | TabWidget = new QTabWidget( this, "TabWidget" ); |
117 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); | 117 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); |
118 | 118 | ||
119 | TabWidget->setTabShape(QTabWidget::Triangular); | 119 | TabWidget->setTabShape(QTabWidget::Triangular); |
120 | 120 | ||
121 | tab = new QWidget( TabWidget, "tab" ); | 121 | tab = new QWidget( TabWidget, "tab" ); |
122 | tabLayout = new QGridLayout( tab ); | 122 | tabLayout = new QGridLayout( tab ); |
123 | tabLayout->setSpacing( 2); | 123 | tabLayout->setSpacing( 2); |
124 | tabLayout->setMargin( 2); | 124 | tabLayout->setMargin( 2); |
125 | 125 | ||
126 | Local_View = new QListView( tab, "Local_View" ); | 126 | Local_View = new QListView( tab, "Local_View" ); |
127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
128 | Local_View->addColumn( tr("File"),150); | 128 | Local_View->addColumn( tr("File"),150); |
129 | Local_View->addColumn( tr("Size"),-1); | 129 | Local_View->addColumn( tr("Size"),-1); |
130 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 130 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
131 | Local_View->addColumn( tr("Date"),-1); | 131 | Local_View->addColumn( tr("Date"),-1); |
132 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 132 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
133 | Local_View->setAllColumnsShowFocus(TRUE); | 133 | Local_View->setAllColumnsShowFocus(TRUE); |
134 | Local_View->setMultiSelection( TRUE ); | 134 | Local_View->setMultiSelection( TRUE ); |
135 | Local_View->setSelectionMode(QlistView::Extended); | 135 | Local_View->setSelectionMode(Q?istView::Extended); |
136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
137 | 137 | ||
138 | tabLayout->addWidget( Local_View, 0, 0 ); | 138 | tabLayout->addWidget( Local_View, 0, 0 ); |
139 | 139 | ||
140 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 140 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
141 | this,SLOT( localListClicked(QListViewItem *)) ); | 141 | this,SLOT( localListClicked(QListViewItem *)) ); |
142 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 142 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
143 | // this,SLOT( localListClicked(QListViewItem *)) ); | 143 | // this,SLOT( localListClicked(QListViewItem *)) ); |
144 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 144 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
145 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 145 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
146 | 146 | ||
147 | TabWidget->insertTab( tab, tr( "Local" ) ); | 147 | TabWidget->insertTab( tab, tr( "Local" ) ); |
148 | 148 | ||
149 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 149 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
150 | tabLayout_2 = new QGridLayout( tab_2 ); | 150 | tabLayout_2 = new QGridLayout( tab_2 ); |
151 | tabLayout_2->setSpacing( 2); | 151 | tabLayout_2->setSpacing( 2); |
152 | tabLayout_2->setMargin( 2); | 152 | tabLayout_2->setMargin( 2); |
153 | 153 | ||
154 | Remote_View = new QListView( tab_2, "Remote_View" ); | 154 | Remote_View = new QListView( tab_2, "Remote_View" ); |
155 | Remote_View->addColumn( tr("File"),150); | 155 | Remote_View->addColumn( tr("File"),150); |
156 | Remote_View->addColumn( tr("Size"),-1); | 156 | Remote_View->addColumn( tr("Size"),-1); |
157 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 157 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
158 | Remote_View->addColumn( tr("Date"),-1); | 158 | Remote_View->addColumn( tr("Date"),-1); |
159 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 159 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
160 | Remote_View->addColumn( tr("Dir"),-1); | 160 | Remote_View->addColumn( tr("Dir"),-1); |
161 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 161 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
162 | Remote_View->setAllColumnsShowFocus(TRUE); | 162 | Remote_View->setAllColumnsShowFocus(TRUE); |
163 | Remote_View->setMultiSelection( TRUE ); | 163 | Remote_View->setMultiSelection( TRUE ); |
164 | Remote_View->setSelectionMode(QlistView::Extended); | 164 | Remote_View->setSelectionMode(QListView::Extended); |
165 | 165 | ||
166 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 166 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
167 | 167 | ||
168 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 168 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
169 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 169 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
170 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 170 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
171 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 171 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
172 | 172 | ||
173 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 173 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
174 | 174 | ||
175 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 175 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
176 | 176 | ||
177 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 177 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
178 | tabLayout_3 = new QGridLayout( tab_3 ); | 178 | tabLayout_3 = new QGridLayout( tab_3 ); |
179 | tabLayout_3->setSpacing( 2); | 179 | tabLayout_3->setSpacing( 2); |
180 | tabLayout_3->setMargin( 2); | 180 | tabLayout_3->setMargin( 2); |
181 | 181 | ||
182 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 182 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
183 | TextLabel1->setText( tr( "Username" ) ); | 183 | TextLabel1->setText( tr( "Username" ) ); |
184 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 184 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
185 | 185 | ||
186 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 186 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
187 | UsernameComboBox->setEditable(TRUE); | 187 | UsernameComboBox->setEditable(TRUE); |
188 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 188 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
189 | 189 | ||
190 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 190 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
191 | TextLabel2->setText( tr( "Password" ) ); | 191 | TextLabel2->setText( tr( "Password" ) ); |
192 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 192 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
193 | 193 | ||
194 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 194 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
195 | PasswordEdit->setEchoMode(QLineEdit::Password); | 195 | PasswordEdit->setEchoMode(QLineEdit::Password); |
196 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 196 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
197 | 197 | ||
198 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 198 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
199 | TextLabel3->setText( tr( "Remote server" ) ); | 199 | TextLabel3->setText( tr( "Remote server" ) ); |
200 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 200 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
201 | 201 | ||
202 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 202 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
203 | ServerComboBox->setEditable(TRUE); | 203 | ServerComboBox->setEditable(TRUE); |
204 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 204 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
205 | 205 | ||
206 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 206 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
207 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 207 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); |
208 | 208 | ||
209 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 209 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
210 | TextLabel5->setText( tr( "Remote path" ) ); | 210 | TextLabel5->setText( tr( "Remote path" ) ); |
211 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 211 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
212 | 212 | ||
213 | 213 | ||
214 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 214 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
215 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 215 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
216 | 216 | ||
217 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 217 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
218 | TextLabel4->setText( tr( "Port" ) ); | 218 | TextLabel4->setText( tr( "Port" ) ); |
219 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 219 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
220 | 220 | ||
221 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 221 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
222 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 222 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
223 | PortSpinBox->setMaxValue(32786); | 223 | PortSpinBox->setMaxValue(32786); |
224 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 224 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
225 | 225 | ||
226 | QPushButton *deleteServerBtn; | 226 | QPushButton *deleteServerBtn; |
227 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); | 227 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); |
228 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | 228 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); |
229 | 229 | ||
230 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 230 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
231 | 231 | ||
232 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 232 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
233 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 233 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
234 | connectServerBtn->setToggleButton(TRUE); | 234 | connectServerBtn->setToggleButton(TRUE); |
235 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 235 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
236 | 236 | ||
237 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 237 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
238 | tabLayout_3->addItem( spacer, 5, 0 ); | 238 | tabLayout_3->addItem( spacer, 5, 0 ); |
239 | 239 | ||
240 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 240 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
241 | 241 | ||
242 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 242 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
243 | this,SLOT(tabChanged(QWidget*))); | 243 | this,SLOT(tabChanged(QWidget*))); |
244 | 244 | ||
245 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 245 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
246 | currentDir.setPath( QDir::currentDirPath()); | 246 | currentDir.setPath( QDir::currentDirPath()); |
247 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 247 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
248 | 248 | ||
249 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 249 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
250 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); | 250 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); |
251 | currentPathCombo->setEditable(TRUE); | 251 | currentPathCombo->setEditable(TRUE); |
252 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 252 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
253 | 253 | ||
254 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 254 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
255 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 255 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
256 | 256 | ||
257 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 257 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
258 | this,SLOT(currentPathComboChanged())); | 258 | this,SLOT(currentPathComboChanged())); |
259 | 259 | ||
260 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 260 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
261 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 261 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
262 | 262 | ||
263 | // fillCombos(); | 263 | // fillCombos(); |
264 | 264 | ||
265 | filterStr="*"; | 265 | filterStr="*"; |
266 | b=FALSE; | 266 | b=FALSE; |
267 | populateLocalView(); | 267 | populateLocalView(); |
268 | readConfig(); | 268 | readConfig(); |
269 | ServerComboBox->setCurrentItem(currentServerConfig); | 269 | ServerComboBox->setCurrentItem(currentServerConfig); |
270 | TabWidget->setCurrentPage(2); | 270 | TabWidget->setCurrentPage(2); |
271 | } | 271 | } |
272 | 272 | ||
273 | OpieFtp::~OpieFtp() | 273 | OpieFtp::~OpieFtp() |
274 | { | 274 | { |
275 | } | 275 | } |
276 | 276 | ||
277 | void OpieFtp::cleanUp() | 277 | void OpieFtp::cleanUp() |
278 | { | 278 | { |
279 | if(conn) | 279 | if(conn) |
280 | FtpQuit(conn); | 280 | FtpQuit(conn); |
281 | QString sfile=QDir::homeDirPath(); | 281 | QString sfile=QDir::homeDirPath(); |
282 | if(sfile.right(1) != "/") | 282 | if(sfile.right(1) != "/") |
283 | sfile+="/._temp"; | 283 | sfile+="/._temp"; |
284 | else | 284 | else |
285 | sfile+="._temp"; | 285 | sfile+="._temp"; |
286 | QFile file( sfile); | 286 | QFile file( sfile); |
287 | if(file.exists()) | 287 | if(file.exists()) |
288 | file.remove(); | 288 | file.remove(); |
289 | exit(0); | 289 | exit(0); |
290 | } | 290 | } |
291 | 291 | ||
292 | void OpieFtp::tabChanged(QWidget *w) | 292 | void OpieFtp::tabChanged(QWidget *w) |
293 | { | 293 | { |
294 | if (TabWidget->currentPageIndex() == 0) { | 294 | if (TabWidget->currentPageIndex() == 0) { |
295 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 295 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
296 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 296 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
297 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 297 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
298 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 298 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
299 | } | 299 | } |
300 | if (TabWidget->currentPageIndex() == 1) { | 300 | if (TabWidget->currentPageIndex() == 1) { |
301 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 301 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
302 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 302 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
303 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 303 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
304 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 304 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
305 | } | 305 | } |
306 | if (TabWidget->currentPageIndex() == 2) { | 306 | if (TabWidget->currentPageIndex() == 2) { |
307 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 307 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
308 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 308 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
309 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 309 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | void OpieFtp::newConnection() | 313 | void OpieFtp::newConnection() |
314 | { | 314 | { |
315 | UsernameComboBox->lineEdit()->setText(""); | 315 | UsernameComboBox->lineEdit()->setText(""); |
316 | PasswordEdit->setText( "" ); | 316 | PasswordEdit->setText( "" ); |
317 | ServerComboBox->lineEdit()->setText( ""); | 317 | ServerComboBox->lineEdit()->setText( ""); |
318 | remotePath->setText( currentRemoteDir = "/"); | 318 | remotePath->setText( currentRemoteDir = "/"); |
319 | PortSpinBox->setValue( 21); | 319 | PortSpinBox->setValue( 21); |
320 | TabWidget->setCurrentPage(2); | 320 | TabWidget->setCurrentPage(2); |
321 | currentServerConfig = -1; | 321 | currentServerConfig = -1; |
322 | } | 322 | } |
323 | 323 | ||
324 | void OpieFtp::serverComboEdited(const QString & edit) | 324 | void OpieFtp::serverComboEdited(const QString & edit) |
325 | { | 325 | { |
326 | if( !edit.isEmpty() ) { | 326 | if( !edit.isEmpty() ) { |
327 | currentServerConfig = -1; | 327 | currentServerConfig = -1; |
328 | // qDebug("comboedited"); | 328 | // qDebug("comboedited"); |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | void OpieFtp::connectorBtnToggled(bool On) | 332 | void OpieFtp::connectorBtnToggled(bool On) |
333 | { | 333 | { |
334 | if(On) { | 334 | if(On) { |
335 | connector(); | 335 | connector(); |
336 | } else { | 336 | } else { |
337 | disConnector(); | 337 | disConnector(); |
338 | } | 338 | } |
339 | 339 | ||
340 | } | 340 | } |
341 | 341 | ||
342 | void OpieFtp::connector() | 342 | void OpieFtp::connector() |
343 | { | 343 | { |
344 | QCopEnvelope ( "QPE/System", "busy()" ); | 344 | QCopEnvelope ( "QPE/System", "busy()" ); |
345 | // qApp->processEvents(); | 345 | // qApp->processEvents(); |
346 | currentRemoteDir=remotePath->text(); | 346 | currentRemoteDir=remotePath->text(); |
347 | if(ServerComboBox->currentText().isEmpty()) { | 347 | if(ServerComboBox->currentText().isEmpty()) { |
348 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 348 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
349 | TabWidget->setCurrentPage(2); | 349 | TabWidget->setCurrentPage(2); |
350 | ServerComboBox->setFocus(); | 350 | ServerComboBox->setFocus(); |
351 | connectServerBtn->setOn(FALSE); | 351 | connectServerBtn->setOn(FALSE); |
352 | connectServerBtn->setText( tr("Connect")); | 352 | connectServerBtn->setText( tr("Connect")); |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | FtpInit(); | 355 | FtpInit(); |
356 | TabWidget->setCurrentPage(1); | 356 | TabWidget->setCurrentPage(1); |