author | llornkcor <llornkcor> | 2002-09-30 01:32:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-30 01:32:04 (UTC) |
commit | 251458a2dd6d75c59440dc006060db2544de5d0e (patch) (unidiff) | |
tree | e367bffa02a6e20caafa7f9917f1222fcaae0ab6 | |
parent | f6e9cebd79044b1ca54648ecdadd13db8c4673dc (diff) | |
download | opie-251458a2dd6d75c59440dc006060db2544de5d0e.zip opie-251458a2dd6d75c59440dc006060db2544de5d0e.tar.gz opie-251458a2dd6d75c59440dc006060db2544de5d0e.tar.bz2 |
fixed scroll, and cleanedup non used variables
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 9beac94..4e14946 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -15,100 +15,100 @@ | |||
15 | 15 | ||
16 | extern "C" { | 16 | extern "C" { |
17 | #include "ftplib.h" | 17 | #include "ftplib.h" |
18 | } | 18 | } |
19 | 19 | ||
20 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
21 | 21 | ||
22 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
23 | #include <qpe/qpetoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/mimetype.h> | 28 | #include <qpe/mimetype.h> |
29 | #include <qpe/qpemessagebox.h> | 29 | #include <qpe/qpemessagebox.h> |
30 | 30 | ||
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qpopupmenu.h> | 40 | #include <qpopupmenu.h> |
41 | #include <qlistview.h> | 41 | #include <qlistview.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qprogressbar.h> | 44 | #include <qprogressbar.h> |
45 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
46 | #include <qtabwidget.h> | 46 | #include <qtabwidget.h> |
47 | #include <qwidget.h> | 47 | #include <qwidget.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qimage.h> | 49 | #include <qimage.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
53 | #include <qregexp.h> | 53 | #include <qregexp.h> |
54 | #include <qlistbox.h> | 54 | #include <qlistbox.h> |
55 | 55 | ||
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | 58 | ||
59 | 59 | ||
60 | QProgressBar *ProgressBar; | 60 | QProgressBar *ProgressBar; |
61 | static netbuf *conn=NULL; | 61 | static netbuf *conn=NULL; |
62 | 62 | ||
63 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 63 | static int log_progress(netbuf *, int xfered, void *) |
64 | { | 64 | { |
65 | int fsz = *(int *)arg; | 65 | // int fsz = *(int *)arg; |
66 | int pct = (xfered * 100) / fsz; | 66 | // int pct = (xfered * 100) / fsz; |
67 | // printf("%3d%%\r", pct); | 67 | // printf("%3d%%\r", pct); |
68 | // fflush(stdout); | 68 | // fflush(stdout); |
69 | ProgressBar->setProgress(xfered); | 69 | ProgressBar->setProgress(xfered); |
70 | qApp->processEvents(); | 70 | qApp->processEvents(); |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | 73 | ||
74 | OpieFtp::OpieFtp( ) | 74 | OpieFtp::OpieFtp( ) |
75 | : QMainWindow( ) | 75 | : QMainWindow( ) |
76 | { | 76 | { |
77 | setCaption( tr( "OpieFtp" ) ); | 77 | setCaption( tr( "OpieFtp" ) ); |
78 | fuckeduphack=FALSE; | 78 | fuckeduphack=FALSE; |
79 | QGridLayout *layout = new QGridLayout( this ); | 79 | QGridLayout *layout = new QGridLayout( this ); |
80 | layout->setSpacing( 2); | 80 | layout->setSpacing( 2); |
81 | layout->setMargin( 2); | 81 | layout->setMargin( 2); |
82 | 82 | ||
83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
84 | 84 | ||
85 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 85 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
86 | // QPEToolBar *menuBar = new QPEToolBar(this); | 86 | // QPEToolBar *menuBar = new QPEToolBar(this); |
87 | // menuBar->setHorizontalStretchable( TRUE ); | 87 | // menuBar->setHorizontalStretchable( TRUE ); |
88 | 88 | ||
89 | connectionMenu = new QPopupMenu( this ); | 89 | connectionMenu = new QPopupMenu( this ); |
90 | localMenu = new QPopupMenu( this ); | 90 | localMenu = new QPopupMenu( this ); |
91 | remoteMenu = new QPopupMenu( this ); | 91 | remoteMenu = new QPopupMenu( this ); |
92 | tabMenu = new QPopupMenu( this ); | 92 | tabMenu = new QPopupMenu( this ); |
93 | 93 | ||
94 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 94 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
95 | 95 | ||
96 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 96 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
97 | menuBar->insertItem( tr( "Local" ), localMenu); | 97 | menuBar->insertItem( tr( "Local" ), localMenu); |
98 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 98 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
99 | menuBar->insertItem( tr( "View" ), tabMenu); | 99 | menuBar->insertItem( tr( "View" ), tabMenu); |
100 | 100 | ||
101 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 101 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
102 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 102 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
103 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 103 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
104 | 104 | ||
105 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 105 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
106 | localMenu->insertSeparator(); | 106 | localMenu->insertSeparator(); |
107 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 107 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
108 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 108 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
109 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 109 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
110 | localMenu->insertSeparator(); | 110 | localMenu->insertSeparator(); |
111 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 111 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
112 | localMenu->setCheckable(TRUE); | 112 | localMenu->setCheckable(TRUE); |
113 | 113 | ||
114 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 114 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
@@ -180,119 +180,122 @@ OpieFtp::OpieFtp( ) | |||
180 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 180 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
181 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 181 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
182 | 182 | ||
183 | TabWidget->insertTab( tab, tr( "Local" ) ); | 183 | TabWidget->insertTab( tab, tr( "Local" ) ); |
184 | 184 | ||
185 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 185 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
186 | tabLayout_2 = new QGridLayout( tab_2 ); | 186 | tabLayout_2 = new QGridLayout( tab_2 ); |
187 | tabLayout_2->setSpacing( 2); | 187 | tabLayout_2->setSpacing( 2); |
188 | tabLayout_2->setMargin( 2); | 188 | tabLayout_2->setMargin( 2); |
189 | 189 | ||
190 | Remote_View = new QListView( tab_2, "Remote_View" ); | 190 | Remote_View = new QListView( tab_2, "Remote_View" ); |
191 | Remote_View->addColumn( tr("File"),150); | 191 | Remote_View->addColumn( tr("File"),150); |
192 | Remote_View->addColumn( tr("Date"),-1); | 192 | Remote_View->addColumn( tr("Date"),-1); |
193 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 193 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
194 | Remote_View->addColumn( tr("Size"),-1); | 194 | Remote_View->addColumn( tr("Size"),-1); |
195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
196 | Remote_View->addColumn( tr("Dir"),-1); | 196 | Remote_View->addColumn( tr("Dir"),-1); |
197 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 197 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
198 | Remote_View->setAllColumnsShowFocus(TRUE); | 198 | Remote_View->setAllColumnsShowFocus(TRUE); |
199 | 199 | ||
200 | Remote_View->setMultiSelection( FALSE); | 200 | Remote_View->setMultiSelection( FALSE); |
201 | Remote_View->setSelectionMode(QListView::Extended); | 201 | Remote_View->setSelectionMode(QListView::Extended); |
202 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 202 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
203 | 203 | ||
204 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 204 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
205 | 205 | ||
206 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 206 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
207 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 207 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
208 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 208 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
209 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 209 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
210 | 210 | ||
211 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 211 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
212 | 212 | ||
213 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 213 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
214 | 214 | ||
215 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 215 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
216 | tabLayout_3 = new QGridLayout( tab_3 ); | 216 | tabLayout_3 = new QGridLayout( tab_3 ); |
217 | tabLayout_3->setSpacing( 2); | 217 | tabLayout_3->setSpacing( 2); |
218 | tabLayout_3->setMargin( 2); | 218 | tabLayout_3->setMargin( 2); |
219 | 219 | ||
220 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 220 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
221 | TextLabel1->setText( tr( "Username" ) ); | 221 | TextLabel1->setText( tr( "Username" ) ); |
222 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 222 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
223 | 223 | ||
224 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 224 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
225 | UsernameComboBox->setEditable(TRUE); | 225 | UsernameComboBox->setEditable(TRUE); |
226 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 226 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
227 | 227 | ||
228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,SLOT( UsernameComboBoxEdited(const QString & ) )); | 228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, |
229 | SLOT( UsernameComboBoxEdited(const QString & ) )); | ||
229 | 230 | ||
230 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 231 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
231 | TextLabel2->setText( tr( "Password" ) ); | 232 | TextLabel2->setText( tr( "Password" ) ); |
232 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 233 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
233 | 234 | ||
234 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 235 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
235 | PasswordEdit->setEchoMode(QLineEdit::Password); | 236 | PasswordEdit->setEchoMode(QLineEdit::Password); |
236 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 237 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
237 | 238 | ||
238 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,SLOT( PasswordEditEdited(const QString & ) )); | 239 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, |
240 | SLOT( PasswordEditEdited(const QString & ) )); | ||
239 | 241 | ||
240 | //PasswordEdit->setFixedWidth(85); | 242 | //PasswordEdit->setFixedWidth(85); |
241 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 243 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
242 | TextLabel3->setText( tr( "Remote server" ) ); | 244 | TextLabel3->setText( tr( "Remote server" ) ); |
243 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 245 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
244 | 246 | ||
245 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 247 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
246 | ServerComboBox->setEditable(TRUE); | 248 | ServerComboBox->setEditable(TRUE); |
247 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 249 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
248 | 250 | ||
249 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 251 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
250 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 252 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, |
253 | SLOT(serverComboEdited(const QString & ) )); | ||
251 | 254 | ||
252 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 255 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
253 | TextLabel5->setText( tr( "Remote path" ) ); | 256 | TextLabel5->setText( tr( "Remote path" ) ); |
254 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 257 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
255 | 258 | ||
256 | 259 | ||
257 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 260 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
258 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 261 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
259 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 262 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
260 | TextLabel4->setText( tr( "Port" ) ); | 263 | TextLabel4->setText( tr( "Port" ) ); |
261 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 264 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
262 | 265 | ||
263 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 266 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
264 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 267 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
265 | PortSpinBox->setMaxValue(32786); | 268 | PortSpinBox->setMaxValue(32786); |
266 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 269 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
267 | 270 | ||
268 | serverListView = new QListBox( tab_3, "ServerListView" ); | 271 | serverListView = new QListBox( tab_3, "ServerListView" ); |
269 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 272 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
270 | 273 | ||
271 | connect( serverListView, SIGNAL( highlighted( const QString &)), | 274 | connect( serverListView, SIGNAL( highlighted( const QString &)), |
272 | this,SLOT( serverListClicked( const QString &) ) ); | 275 | this,SLOT( serverListClicked( const QString &) ) ); |
273 | 276 | ||
274 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 277 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
275 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 278 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
276 | connectServerBtn->setToggleButton(TRUE); | 279 | connectServerBtn->setToggleButton(TRUE); |
277 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 280 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
278 | 281 | ||
279 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); | 282 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); |
280 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 283 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
281 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 284 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
282 | 285 | ||
283 | QPushButton *deleteServerBtn; | 286 | QPushButton *deleteServerBtn; |
284 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); | 287 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); |
285 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 288 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
286 | 289 | ||
287 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 290 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
288 | 291 | ||
289 | 292 | ||
290 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 293 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
291 | tabLayout_3->addItem( spacer, 5, 0 ); | 294 | tabLayout_3->addItem( spacer, 5, 0 ); |
292 | 295 | ||
293 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 296 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
294 | 297 | ||
295 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 298 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
296 | this,SLOT(tabChanged(QWidget*))); | 299 | this,SLOT(tabChanged(QWidget*))); |
297 | 300 | ||
298 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 301 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
@@ -302,192 +305,192 @@ OpieFtp::OpieFtp( ) | |||
302 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 305 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
303 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 306 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
304 | currentPathCombo ->setFixedWidth(220); | 307 | currentPathCombo ->setFixedWidth(220); |
305 | currentPathCombo->setEditable(TRUE); | 308 | currentPathCombo->setEditable(TRUE); |
306 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 309 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
307 | 310 | ||
308 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 311 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
309 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 312 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
310 | 313 | ||
311 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 314 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
312 | this,SLOT(currentPathComboChanged())); | 315 | this,SLOT(currentPathComboChanged())); |
313 | 316 | ||
314 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 317 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
315 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 318 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
316 | ProgressBar->setMaximumHeight(10); | 319 | ProgressBar->setMaximumHeight(10); |
317 | filterStr="*"; | 320 | filterStr="*"; |
318 | b=FALSE; | 321 | b=FALSE; |
319 | populateLocalView(); | 322 | populateLocalView(); |
320 | readConfig(); | 323 | readConfig(); |
321 | 324 | ||
322 | // ServerComboBox->setCurrentItem(currentServerConfig); | 325 | // ServerComboBox->setCurrentItem(currentServerConfig); |
323 | 326 | ||
324 | TabWidget->setCurrentPage(2); | 327 | TabWidget->setCurrentPage(2); |
325 | } | 328 | } |
326 | 329 | ||
327 | OpieFtp::~OpieFtp() | 330 | OpieFtp::~OpieFtp() |
328 | { | 331 | { |
329 | } | 332 | } |
330 | 333 | ||
331 | void OpieFtp::cleanUp() | 334 | void OpieFtp::cleanUp() |
332 | { | 335 | { |
333 | if(conn) | 336 | if(conn) |
334 | FtpQuit(conn); | 337 | FtpQuit(conn); |
335 | QString sfile=QDir::homeDirPath(); | 338 | QString sfile=QDir::homeDirPath(); |
336 | if(sfile.right(1) != "/") | 339 | if(sfile.right(1) != "/") |
337 | sfile+="/._temp"; | 340 | sfile+="/._temp"; |
338 | else | 341 | else |
339 | sfile+="._temp"; | 342 | sfile+="._temp"; |
340 | QFile file( sfile); | 343 | QFile file( sfile); |
341 | if(file.exists()) | 344 | if(file.exists()) |
342 | file.remove(); | 345 | file.remove(); |
343 | Config cfg("opieftp"); | 346 | Config cfg("opieftp"); |
344 | cfg.setGroup("Server"); | 347 | cfg.setGroup("Server"); |
345 | cfg.writeEntry("currentServer", currentServerConfig); | 348 | cfg.writeEntry("currentServer", currentServerConfig); |
346 | 349 | ||
347 | exit(0); | 350 | exit(0); |
348 | } | 351 | } |
349 | 352 | ||
350 | void OpieFtp::tabChanged(QWidget *w) | 353 | void OpieFtp::tabChanged(QWidget *) |
351 | { | 354 | { |
352 | if (TabWidget->currentPageIndex() == 0) { | 355 | if (TabWidget->currentPageIndex() == 0) { |
353 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 356 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
354 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 357 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
355 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 358 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
356 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 359 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
357 | if(cdUpButton->isHidden()) | 360 | if(cdUpButton->isHidden()) |
358 | cdUpButton->show(); | 361 | cdUpButton->show(); |
359 | if(homeButton->isHidden()) | 362 | if(homeButton->isHidden()) |
360 | homeButton->show(); | 363 | homeButton->show(); |
361 | 364 | ||
362 | } | 365 | } |
363 | if (TabWidget->currentPageIndex() == 1) { | 366 | if (TabWidget->currentPageIndex() == 1) { |
364 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 367 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
365 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 368 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
366 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 369 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
367 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 370 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
368 | if(cdUpButton->isHidden()) | 371 | if(cdUpButton->isHidden()) |
369 | cdUpButton->show(); | 372 | cdUpButton->show(); |
370 | homeButton->hide(); | 373 | homeButton->hide(); |
371 | 374 | ||
372 | } | 375 | } |
373 | if (TabWidget->currentPageIndex() == 2) { | 376 | if (TabWidget->currentPageIndex() == 2) { |
374 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 377 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
375 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 378 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
376 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 379 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
377 | cdUpButton->hide(); | 380 | cdUpButton->hide(); |
378 | homeButton->hide(); | 381 | homeButton->hide(); |
379 | } | 382 | } |
380 | } | 383 | } |
381 | 384 | ||
382 | void OpieFtp::newConnection() | 385 | void OpieFtp::newConnection() |
383 | { | 386 | { |
384 | UsernameComboBox->lineEdit()->setText(""); | 387 | UsernameComboBox->lineEdit()->setText(""); |
385 | PasswordEdit->setText( "" ); | 388 | PasswordEdit->setText( "" ); |
386 | ServerComboBox->lineEdit()->setText( ""); | 389 | ServerComboBox->lineEdit()->setText( ""); |
387 | remotePath->setText( currentRemoteDir = "/"); | 390 | remotePath->setText( currentRemoteDir = "/"); |
388 | PortSpinBox->setValue( 21); | 391 | PortSpinBox->setValue( 21); |
389 | TabWidget->setCurrentPage(2); | 392 | TabWidget->setCurrentPage(2); |
390 | } | 393 | } |
391 | 394 | ||
392 | void OpieFtp::serverComboEdited(const QString & edit) | 395 | void OpieFtp::serverComboEdited(const QString & ) |
393 | { | 396 | { |
394 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 397 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
395 | // qDebug("ServerComboEdited"); | 398 | // qDebug("ServerComboEdited"); |
396 | // // currentServerConfig = -1; | 399 | // // currentServerConfig = -1; |
397 | // } | 400 | // } |
398 | } | 401 | } |
399 | 402 | ||
400 | void OpieFtp::UsernameComboBoxEdited(const QString & use) { | 403 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
401 | // currentServerConfig = -1; | 404 | // currentServerConfig = -1; |
402 | } | 405 | } |
403 | 406 | ||
404 | void OpieFtp::PasswordEditEdited(const QString & pass) { | 407 | void OpieFtp::PasswordEditEdited(const QString & ) { |
405 | // currentServerConfig = -1; | 408 | // currentServerConfig = -1; |
406 | } | 409 | } |
407 | 410 | ||
408 | void OpieFtp::connectorBtnToggled(bool On) | 411 | void OpieFtp::connectorBtnToggled(bool On) |
409 | { | 412 | { |
410 | if(On) { | 413 | if(On) { |
411 | connector(); | 414 | connector(); |
412 | } else { | 415 | } else { |
413 | disConnector(); | 416 | disConnector(); |
414 | } | 417 | } |
415 | 418 | ||
416 | } | 419 | } |
417 | 420 | ||
418 | void OpieFtp::connector() | 421 | void OpieFtp::connector() |
419 | { | 422 | { |
420 | // QCopEnvelope ( "QPE/System", "busy()" ); | 423 | // QCopEnvelope ( "QPE/System", "busy()" ); |
421 | // qApp->processEvents(); | 424 | // qApp->processEvents(); |
422 | currentRemoteDir=remotePath->text(); | 425 | currentRemoteDir=remotePath->text(); |
423 | 426 | ||
424 | if( ServerComboBox->currentText().isEmpty()) { | 427 | if( ServerComboBox->currentText().isEmpty()) { |
425 | 428 | ||
426 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 429 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
427 | TabWidget->setCurrentPage(2); | 430 | TabWidget->setCurrentPage(2); |
428 | ServerComboBox->setFocus(); | 431 | ServerComboBox->setFocus(); |
429 | connectServerBtn->setOn(FALSE); | 432 | connectServerBtn->setOn(FALSE); |
430 | connectServerBtn->setText( tr("Connect")); | 433 | connectServerBtn->setText( tr("Connect")); |
431 | return; | 434 | return; |
432 | } | 435 | } |
433 | 436 | ||
434 | FtpInit(); | 437 | FtpInit(); |
435 | 438 | ||
436 | TabWidget->setCurrentPage(1); | 439 | TabWidget->setCurrentPage(1); |
437 | QString ftp_host = ServerComboBox->currentText(); | 440 | QString ftp_host = ServerComboBox->currentText(); |
438 | QString ftp_user = UsernameComboBox->currentText(); | 441 | QString ftp_user = UsernameComboBox->currentText(); |
439 | QString ftp_pass = PasswordEdit->text(); | 442 | QString ftp_pass = PasswordEdit->text(); |
440 | QString port=PortSpinBox->cleanText(); | 443 | QString port=PortSpinBox->cleanText(); |
441 | port.stripWhiteSpace(); | 444 | port.stripWhiteSpace(); |
442 | 445 | ||
443 | Config cfg("opieftp"); | 446 | Config cfg("opieftp"); |
444 | cfg.setGroup("Server"); | 447 | cfg.setGroup("Server"); |
445 | int current=cfg.readNumEntry("currentServer", 1); | 448 | // int current=cfg.readNumEntry("currentServer", 1); |
446 | 449 | ||
447 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | 450 | // if(ftp_host!= cfg.readEntry(QString::number( current))) |
448 | // currentServerConfig=-1; | 451 | // currentServerConfig=-1; |
449 | // cfg.setGroup(QString::number(current)); | 452 | // cfg.setGroup(QString::number(current)); |
450 | // if( ftp_user != cfg.readEntry("Username")) | 453 | // if( ftp_user != cfg.readEntry("Username")) |
451 | // currentServerConfig=-1; | 454 | // currentServerConfig=-1; |
452 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) | 455 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) |
453 | // currentServerConfig=-1; | 456 | // currentServerConfig=-1; |
454 | 457 | ||
455 | 458 | ||
456 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 459 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
457 | ftp_host=ftp_host.right(ftp_host.length()-6); | 460 | ftp_host=ftp_host.right(ftp_host.length()-6); |
458 | ftp_host+=":"+port; | 461 | ftp_host+=":"+port; |
459 | 462 | ||
460 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 463 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
461 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 464 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
462 | connectServerBtn->setOn(FALSE); | 465 | connectServerBtn->setOn(FALSE); |
463 | connectServerBtn->setText( tr("Connect")); | 466 | connectServerBtn->setText( tr("Connect")); |
464 | return ; | 467 | return ; |
465 | } | 468 | } |
466 | 469 | ||
467 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 470 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
468 | QString msg; | 471 | QString msg; |
469 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 472 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
470 | msg.replace(QRegExp(":"),"\n"); | 473 | msg.replace(QRegExp(":"),"\n"); |
471 | QMessageBox::message(tr("Note"),msg); | 474 | QMessageBox::message(tr("Note"),msg); |
472 | if(conn) | 475 | if(conn) |
473 | FtpQuit(conn); | 476 | FtpQuit(conn); |
474 | connectServerBtn->setOn(FALSE); | 477 | connectServerBtn->setOn(FALSE); |
475 | connectServerBtn->setText( tr("Connect")); | 478 | connectServerBtn->setText( tr("Connect")); |
476 | return ; | 479 | return ; |
477 | } | 480 | } |
478 | 481 | ||
479 | remoteDirList("/") ; | 482 | remoteDirList("/") ; |
480 | setCaption(ftp_host); | 483 | setCaption(ftp_host); |
481 | if( currentServerConfig == -1) | 484 | if( currentServerConfig == -1) |
482 | writeConfig(); | 485 | writeConfig(); |
483 | connectServerBtn->setText( tr("Disconnect")); | 486 | connectServerBtn->setText( tr("Disconnect")); |
484 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 487 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
485 | } | 488 | } |
486 | 489 | ||
487 | void OpieFtp::disConnector() | 490 | void OpieFtp::disConnector() |
488 | { | 491 | { |
489 | if(conn) | 492 | if(conn) |
490 | FtpQuit(conn); | 493 | FtpQuit(conn); |
491 | setCaption("OpieFtp"); | 494 | setCaption("OpieFtp"); |
492 | currentRemoteDir="/"; | 495 | currentRemoteDir="/"; |
493 | Remote_View->clear(); | 496 | Remote_View->clear(); |
@@ -608,102 +611,102 @@ bool OpieFtp::remoteDirList(const QString &dir) | |||
608 | else | 611 | else |
609 | tmp+="._temp"; | 612 | tmp+="._temp"; |
610 | // qDebug("Listing remote dir "+tmp); | 613 | // qDebug("Listing remote dir "+tmp); |
611 | // QCopEnvelope ( "QPE/System", "busy()" ); | 614 | // QCopEnvelope ( "QPE/System", "busy()" ); |
612 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 615 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
613 | QString msg; | 616 | QString msg; |
614 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 617 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
615 | msg.replace(QRegExp(":"),"\n"); | 618 | msg.replace(QRegExp(":"),"\n"); |
616 | QMessageBox::message(tr("Note"),msg); | 619 | QMessageBox::message(tr("Note"),msg); |
617 | return false; | 620 | return false; |
618 | } | 621 | } |
619 | populateRemoteView() ; | 622 | populateRemoteView() ; |
620 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 623 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
621 | return true; | 624 | return true; |
622 | } | 625 | } |
623 | 626 | ||
624 | bool OpieFtp::remoteChDir(const QString &dir) | 627 | bool OpieFtp::remoteChDir(const QString &dir) |
625 | { | 628 | { |
626 | // QCopEnvelope ( "QPE/System", "busy()" ); | 629 | // QCopEnvelope ( "QPE/System", "busy()" ); |
627 | if (!FtpChdir( dir.latin1(), conn )) { | 630 | if (!FtpChdir( dir.latin1(), conn )) { |
628 | QString msg; | 631 | QString msg; |
629 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 632 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
630 | msg.replace(QRegExp(":"),"\n"); | 633 | msg.replace(QRegExp(":"),"\n"); |
631 | QMessageBox::message(tr("Note"),msg); | 634 | QMessageBox::message(tr("Note"),msg); |
632 | // qDebug(msg); | 635 | // qDebug(msg); |
633 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 636 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
634 | return FALSE; | 637 | return FALSE; |
635 | } | 638 | } |
636 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 639 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
637 | return TRUE; | 640 | return TRUE; |
638 | } | 641 | } |
639 | 642 | ||
640 | void OpieFtp::populateLocalView() | 643 | void OpieFtp::populateLocalView() |
641 | { | 644 | { |
642 | Local_View->clear(); | 645 | Local_View->clear(); |
643 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 646 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
644 | currentDir.setMatchAllDirs(TRUE); | 647 | currentDir.setMatchAllDirs(TRUE); |
645 | currentDir.setNameFilter(filterStr); | 648 | currentDir.setNameFilter(filterStr); |
646 | QString fileL, fileS, fileDate; | 649 | QString fileL, fileS, fileDate; |
647 | bool isDir=FALSE; | 650 | bool isDir=FALSE; |
648 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 651 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
649 | QFileInfoListIterator it(*list); | 652 | QFileInfoListIterator it(*list); |
650 | QFileInfo *fi; | 653 | QFileInfo *fi; |
651 | while ( (fi=it.current()) ) { | 654 | while ( (fi=it.current()) ) { |
652 | if (fi->isSymLink() ){ | 655 | if (fi->isSymLink() ){ |
653 | QString symLink=fi->readLink(); | 656 | QString symLink=fi->readLink(); |
654 | // qDebug("Symlink detected "+symLink); | 657 | // qDebug("Symlink detected "+symLink); |
655 | QFileInfo sym( symLink); | 658 | QFileInfo sym( symLink); |
656 | fileS.sprintf( "%10li", sym.size() ); | 659 | fileS.sprintf( "%10i", sym.size() ); |
657 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 660 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
658 | fileDate = sym.lastModified().toString(); | 661 | fileDate = sym.lastModified().toString(); |
659 | } else { | 662 | } else { |
660 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 663 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
661 | fileS.sprintf( "%10li", fi->size() ); | 664 | fileS.sprintf( "%10i", fi->size() ); |
662 | fileL.sprintf( "%s",fi->fileName().data() ); | 665 | fileL.sprintf( "%s",fi->fileName().data() ); |
663 | fileDate= fi->lastModified().toString(); | 666 | fileDate= fi->lastModified().toString(); |
664 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 667 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
665 | fileL+="/"; | 668 | fileL+="/"; |
666 | isDir=TRUE; | 669 | isDir=TRUE; |
667 | // qDebug( fileL); | 670 | // qDebug( fileL); |
668 | } | 671 | } |
669 | } | 672 | } |
670 | if(fileL !="./" && fi->exists()) { | 673 | if(fileL !="./" && fi->exists()) { |
671 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); | 674 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
672 | QPixmap pm; | 675 | QPixmap pm; |
673 | 676 | ||
674 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 677 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
675 | if( !QDir( fi->filePath() ).isReadable()) | 678 | if( !QDir( fi->filePath() ).isReadable()) |
676 | pm = Resource::loadPixmap( "lockedfolder" ); | 679 | pm = Resource::loadPixmap( "lockedfolder" ); |
677 | else | 680 | else |
678 | pm= Resource::loadPixmap( "folder" ); | 681 | pm= Resource::loadPixmap( "folder" ); |
679 | item->setPixmap( 0,pm ); | 682 | item->setPixmap( 0,pm ); |
680 | } else { | 683 | } else { |
681 | if( !fi->isReadable() ) | 684 | if( !fi->isReadable() ) |
682 | pm = Resource::loadPixmap( "locked" ); | 685 | pm = Resource::loadPixmap( "locked" ); |
683 | else { | 686 | else { |
684 | MimeType mt(fi->filePath()); | 687 | MimeType mt(fi->filePath()); |
685 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 688 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
686 | if(pm.isNull()) | 689 | if(pm.isNull()) |
687 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 690 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
688 | item->setPixmap( 0,pm); | 691 | item->setPixmap( 0,pm); |
689 | } | 692 | } |
690 | } | 693 | } |
691 | if( fileL.find("->",0,TRUE) != -1) { | 694 | if( fileL.find("->",0,TRUE) != -1) { |
692 | // overlay link image | 695 | // overlay link image |
693 | pm= Resource::loadPixmap( "folder" ); | 696 | pm= Resource::loadPixmap( "folder" ); |
694 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 697 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
695 | QPainter painter( &pm ); | 698 | QPainter painter( &pm ); |
696 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 699 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
697 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 700 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
698 | item->setPixmap( 0, pm); | 701 | item->setPixmap( 0, pm); |
699 | } | 702 | } |
700 | } | 703 | } |
701 | isDir=FALSE; | 704 | isDir=FALSE; |
702 | ++it; | 705 | ++it; |
703 | } | 706 | } |
704 | Local_View->setSorting( 3,FALSE); | 707 | Local_View->setSorting( 3,FALSE); |
705 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 708 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
706 | fillCombo( (const QString &)currentDir); | 709 | fillCombo( (const QString &)currentDir); |
707 | } | 710 | } |
708 | 711 | ||
709 | bool OpieFtp::populateRemoteView( ) | 712 | bool OpieFtp::populateRemoteView( ) |
@@ -769,177 +772,180 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
769 | strItem=strItem.simplifyWhiteSpace(); | 772 | strItem=strItem.simplifyWhiteSpace(); |
770 | if(strItem == "../") { // the user wants to go ^ | 773 | if(strItem == "../") { // the user wants to go ^ |
771 | if( FtpCDUp( conn) == 0) { | 774 | if( FtpCDUp( conn) == 0) { |
772 | QString msg; | 775 | QString msg; |
773 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 776 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
774 | msg.replace(QRegExp(":"),"\n"); | 777 | msg.replace(QRegExp(":"),"\n"); |
775 | QMessageBox::message(tr("Note"),msg); | 778 | QMessageBox::message(tr("Note"),msg); |
776 | // qDebug(msg); | 779 | // qDebug(msg); |
777 | } | 780 | } |
778 | char path[256]; | 781 | char path[256]; |
779 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 782 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
780 | QString msg; | 783 | QString msg; |
781 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 784 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
782 | msg.replace(QRegExp(":"),"\n"); | 785 | msg.replace(QRegExp(":"),"\n"); |
783 | QMessageBox::message(tr("Note"),msg); | 786 | QMessageBox::message(tr("Note"),msg); |
784 | // qDebug(msg); | 787 | // qDebug(msg); |
785 | } | 788 | } |
786 | currentRemoteDir=path; | 789 | currentRemoteDir=path; |
787 | } else { | 790 | } else { |
788 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 791 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
789 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 792 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
790 | strItem = strItem.stripWhiteSpace(); | 793 | strItem = strItem.stripWhiteSpace(); |
791 | currentRemoteDir = strItem; | 794 | currentRemoteDir = strItem; |
792 | if( !remoteChDir( (const QString &)strItem)) { | 795 | if( !remoteChDir( (const QString &)strItem)) { |
793 | currentRemoteDir = oldRemoteCurrentDir; | 796 | currentRemoteDir = oldRemoteCurrentDir; |
794 | strItem=""; | 797 | strItem=""; |
795 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 798 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
796 | } | 799 | } |
797 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 800 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
798 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 801 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
799 | currentRemoteDir = oldRemoteCurrentDir; | 802 | currentRemoteDir = oldRemoteCurrentDir; |
800 | strItem=""; | 803 | strItem=""; |
801 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 804 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
802 | 805 | ||
803 | } else { | 806 | } else { |
804 | currentRemoteDir = currentRemoteDir+strItem; | 807 | currentRemoteDir = currentRemoteDir+strItem; |
805 | } | 808 | } |
806 | } else { | 809 | } else { |
807 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 810 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
808 | return; | 811 | return; |
809 | } | 812 | } |
810 | } | 813 | } |
811 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 814 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
812 | if(currentRemoteDir.right(1) !="/") | 815 | if(currentRemoteDir.right(1) !="/") |
813 | currentRemoteDir +="/"; | 816 | currentRemoteDir +="/"; |
814 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 817 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
815 | fillRemoteCombo( (const QString &)currentRemoteDir); | 818 | fillRemoteCombo( (const QString &)currentRemoteDir); |
816 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 819 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
820 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | ||
821 | |||
817 | } | 822 | } |
818 | } | 823 | } |
819 | 824 | ||
820 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 825 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
821 | { | 826 | { |
822 | if(selectedItem!= NULL) { | 827 | if(selectedItem!= NULL) { |
823 | 828 | ||
824 | QString strItem=selectedItem->text(0); | 829 | QString strItem=selectedItem->text(0); |
825 | QString strSize=selectedItem->text(1); | 830 | QString strSize=selectedItem->text(1); |
826 | strSize=strSize.stripWhiteSpace(); | 831 | strSize=strSize.stripWhiteSpace(); |
827 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 832 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
828 | // is symlink | 833 | // is symlink |
829 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 834 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
830 | if(QDir(strItem2).exists() ) { | 835 | if(QDir(strItem2).exists() ) { |
831 | currentDir.cd(strItem2, TRUE); | 836 | currentDir.cd(strItem2, TRUE); |
832 | populateLocalView(); | 837 | populateLocalView(); |
833 | } | 838 | } |
834 | } else { // not a symlink | 839 | } else { // not a symlink |
835 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 840 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
836 | 841 | ||
837 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 842 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
838 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 843 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
839 | currentDir.cd(strItem,FALSE); | 844 | currentDir.cd(strItem,FALSE); |
840 | populateLocalView(); | 845 | populateLocalView(); |
841 | } else { | 846 | } else { |
842 | currentDir.cdUp(); | 847 | currentDir.cdUp(); |
843 | populateLocalView(); | 848 | populateLocalView(); |
844 | } | 849 | } |
845 | if(QDir(strItem).exists()){ | 850 | if(QDir(strItem).exists()){ |
846 | currentDir.cd(strItem, TRUE); | 851 | currentDir.cd(strItem, TRUE); |
847 | populateLocalView(); | 852 | populateLocalView(); |
848 | } | 853 | } |
849 | } else { | 854 | } else { |
850 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 855 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
851 | if( QFile::exists(strItem ) ) { | 856 | if( QFile::exists(strItem ) ) { |
852 | // qDebug("upload "+strItem); | 857 | // qDebug("upload "+strItem); |
853 | return; | 858 | return; |
854 | } | 859 | } |
855 | } //end not symlink | 860 | } //end not symlink |
856 | chdir(strItem.latin1()); | 861 | chdir(strItem.latin1()); |
857 | } | 862 | } |
863 | Local_View->ensureItemVisible(Local_View->firstChild()); | ||
858 | } | 864 | } |
859 | } | 865 | } |
860 | 866 | ||
861 | void OpieFtp::doLocalCd() | 867 | void OpieFtp::doLocalCd() |
862 | { | 868 | { |
863 | localListClicked( Local_View->currentItem()); | 869 | localListClicked( Local_View->currentItem()); |
864 | } | 870 | } |
865 | 871 | ||
866 | void OpieFtp:: doRemoteCd() | 872 | void OpieFtp:: doRemoteCd() |
867 | { | 873 | { |
868 | remoteListClicked( Remote_View->currentItem()); | 874 | remoteListClicked( Remote_View->currentItem()); |
869 | 875 | ||
870 | } | 876 | } |
871 | 877 | ||
872 | void OpieFtp::showHidden() | 878 | void OpieFtp::showHidden() |
873 | { | 879 | { |
874 | if (!b) { | 880 | if (!b) { |
875 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 881 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
876 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 882 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
877 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 883 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
878 | b=TRUE; | 884 | b=TRUE; |
879 | 885 | ||
880 | } else { | 886 | } else { |
881 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 887 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
882 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 888 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
883 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 889 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
884 | b=FALSE; | 890 | b=FALSE; |
885 | } | 891 | } |
886 | populateLocalView(); | 892 | populateLocalView(); |
887 | } | 893 | } |
888 | 894 | ||
889 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 895 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int) |
890 | { | 896 | { |
891 | // if(item) | 897 | // if(item) |
892 | if (mouse == 2) { | 898 | if (mouse == 2) { |
893 | showLocalMenu(item); | 899 | showLocalMenu(item); |
894 | } | 900 | } |
895 | } | 901 | } |
896 | 902 | ||
897 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 903 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int ) |
898 | { | 904 | { |
899 | if(mouse == 2) { | 905 | if(mouse == 2) { |
900 | showRemoteMenu(item); | 906 | showRemoteMenu(item); |
901 | } | 907 | } |
902 | } | 908 | } |
903 | 909 | ||
904 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 910 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
905 | { | 911 | { |
906 | QPopupMenu * m;// = new QPopupMenu( Local_View ); | 912 | QPopupMenu * m;// = new QPopupMenu( Local_View ); |
907 | m = new QPopupMenu(this); | 913 | m = new QPopupMenu(this); |
908 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) | 914 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) |
909 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 915 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
910 | else | 916 | else |
911 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 917 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
912 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 918 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
913 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); | 919 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); |
914 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 920 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
915 | m->insertSeparator(); | 921 | m->insertSeparator(); |
916 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 922 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
917 | m->exec( QCursor::pos() ); | 923 | m->exec( QCursor::pos() ); |
918 | delete m; | 924 | delete m; |
919 | } | 925 | } |
920 | 926 | ||
921 | void OpieFtp::showLocalMenu(QListViewItem * item) | 927 | void OpieFtp::showLocalMenu(QListViewItem * item) |
922 | { | 928 | { |
923 | 929 | ||
924 | QPopupMenu *m; | 930 | QPopupMenu *m; |
925 | m = new QPopupMenu( this); | 931 | m = new QPopupMenu( this); |
926 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 932 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
927 | m->insertSeparator(); | 933 | m->insertSeparator(); |
928 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 934 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
929 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 935 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
930 | else | 936 | else |
931 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 937 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
932 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 938 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
933 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); | 939 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); |
934 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 940 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
935 | m->insertSeparator(); | 941 | m->insertSeparator(); |
936 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 942 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
937 | m->setCheckable(TRUE); | 943 | m->setCheckable(TRUE); |
938 | if (b) | 944 | if (b) |
939 | m->setItemChecked(m->idAt(0),TRUE); | 945 | m->setItemChecked(m->idAt(0),TRUE); |
940 | else | 946 | else |
941 | m->setItemChecked(m->idAt(0),FALSE); | 947 | m->setItemChecked(m->idAt(0),FALSE); |
942 | 948 | ||
943 | m->exec( QCursor::pos() ); | 949 | m->exec( QCursor::pos() ); |
944 | delete m; | 950 | delete m; |
945 | } | 951 | } |
@@ -1260,97 +1266,97 @@ void OpieFtp::clearCombos() { | |||
1260 | 1266 | ||
1261 | 1267 | ||
1262 | void OpieFtp::fillCombos() | 1268 | void OpieFtp::fillCombos() |
1263 | { | 1269 | { |
1264 | clearCombos(); | 1270 | clearCombos(); |
1265 | 1271 | ||
1266 | Config cfg("opieftp"); | 1272 | Config cfg("opieftp"); |
1267 | cfg.setGroup("Server"); | 1273 | cfg.setGroup("Server"); |
1268 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1274 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1269 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1275 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1270 | 1276 | ||
1271 | for (int i = 1; i <= numberOfEntries; i++) { | 1277 | for (int i = 1; i <= numberOfEntries; i++) { |
1272 | temp.setNum(i); | 1278 | temp.setNum(i); |
1273 | qDebug(temp); | 1279 | qDebug(temp); |
1274 | cfg.setGroup("Server"); | 1280 | cfg.setGroup("Server"); |
1275 | remoteServerStr = cfg.readEntry( temp,""); | 1281 | remoteServerStr = cfg.readEntry( temp,""); |
1276 | qDebug( remoteServerStr); | 1282 | qDebug( remoteServerStr); |
1277 | 1283 | ||
1278 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1284 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1279 | port = remoteServerStr.right( divider - 1); | 1285 | port = remoteServerStr.right( divider - 1); |
1280 | bool ok; | 1286 | bool ok; |
1281 | PortSpinBox->setValue( port.toInt(&ok,10)); | 1287 | PortSpinBox->setValue( port.toInt(&ok,10)); |
1282 | 1288 | ||
1283 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1289 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1284 | qDebug( "remote server string "+remoteServerStr); | 1290 | qDebug( "remote server string "+remoteServerStr); |
1285 | ServerComboBox->insertItem( remoteServerStr ); | 1291 | ServerComboBox->insertItem( remoteServerStr ); |
1286 | 1292 | ||
1287 | cfg.setGroup(temp); | 1293 | cfg.setGroup(temp); |
1288 | 1294 | ||
1289 | username = cfg.readEntry(temp); | 1295 | username = cfg.readEntry(temp); |
1290 | UsernameComboBox->insertItem(username); | 1296 | UsernameComboBox->insertItem(username); |
1291 | password = cfg.readEntryCrypt(username,""); | 1297 | password = cfg.readEntryCrypt(username,""); |
1292 | PasswordEdit->setText(password); | 1298 | PasswordEdit->setText(password); |
1293 | 1299 | ||
1294 | serverListView->insertItem( cfg.readEntry("ServerName")); | 1300 | serverListView->insertItem( cfg.readEntry("ServerName")); |
1295 | } | 1301 | } |
1296 | } | 1302 | } |
1297 | 1303 | ||
1298 | 1304 | ||
1299 | void OpieFtp::serverComboSelected(int index) | 1305 | void OpieFtp::serverComboSelected(int index) |
1300 | { | 1306 | { |
1301 | currentServerConfig = index+1; | 1307 | currentServerConfig = index+1; |
1302 | qDebug("server combo selected %d", index+1); | 1308 | qDebug("server combo selected %d", index+1); |
1303 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1309 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1304 | // remoteServerStr = ServerComboBox->text(index); | 1310 | // remoteServerStr = ServerComboBox->text(index); |
1305 | 1311 | ||
1306 | Config cfg("opieftp"); | 1312 | Config cfg("opieftp"); |
1307 | cfg.setGroup("Server"); | 1313 | cfg.setGroup("Server"); |
1308 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1314 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1309 | 1315 | ||
1310 | temp.setNum(index+1); | 1316 | temp.setNum(index+1); |
1311 | remoteServerStr = cfg.readEntry( temp,""); | 1317 | remoteServerStr = cfg.readEntry( temp,""); |
1312 | 1318 | ||
1313 | qDebug("Group" +temp); | 1319 | qDebug("Group" +temp); |
1314 | cfg.setGroup(temp); | 1320 | cfg.setGroup(temp); |
1315 | // qDebug(temp); | 1321 | // qDebug(temp); |
1316 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1322 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1317 | port = remoteServerStr.right( divider - 1); | 1323 | port = remoteServerStr.right( divider - 1); |
1318 | bool ok; | 1324 | bool ok; |
1319 | int portInt = port.toInt(&ok,10); | 1325 | int portInt = port.toInt(&ok,10); |
1320 | if( portInt == 0) portInt = 21; | 1326 | if( portInt == 0) portInt = 21; |
1321 | 1327 | ||
1322 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); | 1328 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); |
1323 | 1329 | ||
1324 | PortSpinBox->setValue( portInt); | 1330 | PortSpinBox->setValue( portInt); |
1325 | 1331 | ||
1326 | remotePath->setText(cfg.readEntry("RemotePath", "/")); | 1332 | remotePath->setText(cfg.readEntry("RemotePath", "/")); |
1327 | 1333 | ||
1328 | username = cfg.readEntry("Username", "anonymous"); | 1334 | username = cfg.readEntry("Username", "anonymous"); |
1329 | UsernameComboBox->lineEdit()->setText(username); | 1335 | UsernameComboBox->lineEdit()->setText(username); |
1330 | qDebug(username); | 1336 | qDebug(username); |
1331 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); | 1337 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); |
1332 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | 1338 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); |
1333 | // UsernameComboBox | 1339 | // UsernameComboBox |
1334 | // PasswordEdit | 1340 | // PasswordEdit |
1335 | 1341 | ||
1336 | cfg.setGroup("Server"); | 1342 | cfg.setGroup("Server"); |
1337 | temp.sprintf("%d",currentServerConfig); | 1343 | temp.sprintf("%d",currentServerConfig); |
1338 | cfg.writeEntry("currentServer", temp); | 1344 | cfg.writeEntry("currentServer", temp); |
1339 | 1345 | ||
1340 | fuckeduphack = TRUE; | 1346 | fuckeduphack = TRUE; |
1341 | serverListView->setCurrentItem( index); | 1347 | serverListView->setCurrentItem( index); |
1342 | fuckeduphack=FALSE; | 1348 | fuckeduphack=FALSE; |
1343 | qDebug("server list set selected %d",index); | 1349 | qDebug("server list set selected %d",index); |
1344 | update(); | 1350 | update(); |
1345 | } | 1351 | } |
1346 | 1352 | ||
1347 | void OpieFtp::deleteServer() | 1353 | void OpieFtp::deleteServer() |
1348 | { | 1354 | { |
1349 | QString username, remoteServerStr, remotePathStr, password, port, temp, servername; | 1355 | QString username, remoteServerStr, remotePathStr, password, port, temp, servername; |
1350 | remoteServerStr = ServerComboBox->currentText( ); | 1356 | remoteServerStr = ServerComboBox->currentText( ); |
1351 | username = UsernameComboBox->currentText(); | 1357 | username = UsernameComboBox->currentText(); |
1352 | servername=serverListView->currentText(); | 1358 | servername=serverListView->currentText(); |
1353 | 1359 | ||
1354 | Config cfg("opieftp"); | 1360 | Config cfg("opieftp"); |
1355 | cfg.setGroup("Server"); | 1361 | cfg.setGroup("Server"); |
1356 | QString tempname; | 1362 | QString tempname; |