summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-18 11:09:44 (UTC)
committer llornkcor <llornkcor>2004-09-18 11:09:44 (UTC)
commit35d96e2215c765da2270589c059c717a858333ca (patch) (unidiff)
tree3c961279d7f859e235aa2b46f6fd67b5a9710629
parent4222b8c08a965d45f94bc5a6888f90b2cc9a446c (diff)
downloadopie-35d96e2215c765da2270589c059c717a858333ca.zip
opie-35d96e2215c765da2270589c059c717a858333ca.tar.gz
opie-35d96e2215c765da2270589c059c717a858333ca.tar.bz2
fix layout issue
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp49
1 files changed, 31 insertions, 18 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index b703217..64146cb 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,200 +1,203 @@
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 15
16extern "C" { 16extern "C" {
17#include <ftplib.h> 17#include <ftplib.h>
18} 18}
19 19
20#include "inputDialog.h" 20#include "inputDialog.h"
21 21
22/* OPIE */ 22/* OPIE */
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/mimetype.h> 27#include <qpe/mimetype.h>
28using namespace Opie::Core; 28using namespace Opie::Core;
29 29
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qprogressbar.h> 36#include <qprogressbar.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qtabwidget.h> 38#include <qtabwidget.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qmenubar.h> 41#include <qmenubar.h>
42#include <qpe/qpemenubar.h>
43
42#include <qlineedit.h> 44#include <qlineedit.h>
43#include <qlistbox.h> 45#include <qlistbox.h>
44#include <qvbox.h> 46#include <qvbox.h>
45/* STD */ 47/* STD */
46#include <unistd.h> 48#include <unistd.h>
47#include <stdlib.h> 49#include <stdlib.h>
48 50
49QProgressBar *ProgressBar; 51QProgressBar *ProgressBar;
50static netbuf *conn=NULL; 52static netbuf *conn=NULL;
51 53
52static int log_progress(netbuf *, int xfered, void *) 54static int log_progress(netbuf *, int xfered, void *)
53{ 55{
54// int fsz = *(int *)arg; 56// int fsz = *(int *)arg;
55// int pct = (xfered * 100) / fsz; 57// int pct = (xfered * 100) / fsz;
56// printf("%3d%%\r", pct); 58// printf("%3d%%\r", pct);
57// fflush(stdout); 59// fflush(stdout);
58 ProgressBar->setProgress(xfered); 60 ProgressBar->setProgress(xfered);
59 qApp->processEvents(); 61 qApp->processEvents();
60 return 1; 62 return 1;
61} 63}
62 64
63OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) 65OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
64 : QMainWindow( parent, name, fl ) 66 : QMainWindow( parent, name, fl )
65{ 67{
66 odebug << "OpieFtp constructor" << oendl; 68 odebug << "OpieFtp constructor" << oendl;
67 setCaption( tr( "OpieFtp" ) ); 69 setCaption( tr( "OpieFtp" ) );
68 fuckeduphack=FALSE; 70 fuckeduphack=FALSE;
69 71
70 QVBox* wrapperBox = new QVBox( this ); 72 QVBox* wrapperBox = new QVBox( this );
71 setCentralWidget( wrapperBox ); 73 setCentralWidget( wrapperBox );
72 74
73 QWidget *view = new QWidget( wrapperBox ); 75 QWidget *view = new QWidget( wrapperBox );
74 76
75 QGridLayout *layout = new QGridLayout( view ); 77 QGridLayout *layout = new QGridLayout( view );
76 layout->setSpacing( 2); 78 layout->setSpacing( 1);
77 layout->setMargin( 2); 79 layout->setMargin( 1);
78 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 80 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
79 81
80 QMenuBar *menuBar = new QMenuBar(this); 82 QPEMenuBar *menuBar = new QPEMenuBar(view);
81// QToolBar *menuBar = new QToolBar(this); 83// QMenuBar *menuBar = new QMenuBar(this);
84// QPEToolBar *menuBar = new QPEToolBar(this);
82// menuBar->setHorizontalStretchable( TRUE ); 85// menuBar->setHorizontalStretchable( TRUE );
83 86
84 QWMatrix matrix; 87 QWMatrix matrix;
85 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 88 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
86 matrix.scale( .4, .4); 89 matrix.scale( .4, .4);
87 unknownXpm = pix.xForm(matrix); 90 unknownXpm = pix.xForm(matrix);
88 91
89 connectionMenu = new QPopupMenu( this ); 92 connectionMenu = new QPopupMenu( this );
90 localMenu = new QPopupMenu( this ); 93 localMenu = new QPopupMenu( this );
91 remoteMenu = new QPopupMenu( this ); 94 remoteMenu = new QPopupMenu( this );
92 tabMenu = new QPopupMenu( this ); 95 tabMenu = new QPopupMenu( this );
93 96
94//#if 0 97//#if 0
95 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 98 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
96//#endif 99//#endif
97 100
98 menuBar->insertItem( tr( "Connection" ), connectionMenu); 101 menuBar->insertItem( tr( "Connection" ), connectionMenu);
99// menuBar->insertItem( tr( "Local" ), localMenu); 102// menuBar->insertItem( tr( "Local" ), localMenu);
100// menuBar->insertItem( tr( "Remote" ), remoteMenu); 103// menuBar->insertItem( tr( "Remote" ), remoteMenu);
101 menuBar->insertItem( tr( "View" ), tabMenu); 104 menuBar->insertItem( tr( "View" ), tabMenu);
102 105
103 tabMenu->insertItem( tr( "Local" ), localMenu); 106 tabMenu->insertItem( tr( "Local" ), localMenu);
104 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 107 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
105 108
106 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 109 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
107 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 110 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
108 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 111 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
109 112
110 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 113 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
111 localMenu->insertSeparator(); 114 localMenu->insertSeparator();
112 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 115 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
113 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 116 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
114 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 117 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
115 localMenu->insertSeparator(); 118 localMenu->insertSeparator();
116 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 119 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
117 localMenu->setCheckable(TRUE); 120 localMenu->setCheckable(TRUE);
118 121
119 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 122 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
120 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 123 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
121 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 124 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
122 remoteMenu->insertSeparator(); 125 remoteMenu->insertSeparator();
123 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 126 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
124 127
125 tabMenu->insertSeparator(); 128 tabMenu->insertSeparator();
126 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 129 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
127 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 130 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
128 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 131 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
129 tabMenu->insertSeparator(); 132 tabMenu->insertSeparator();
130// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 133// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
131 tabMenu->setCheckable(TRUE); 134 tabMenu->setCheckable(TRUE);
132 135
133 136
134 cdUpButton = new QToolButton( view,"cdUpButton"); 137 cdUpButton = new QToolButton( view,"cdUpButton");
135 cdUpButton->setPixmap(Resource::loadPixmap("up")); 138 cdUpButton->setPixmap(Resource::loadPixmap("up"));
136 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 139 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
137 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 140 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
138 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 141 layout->addMultiCellWidget( cdUpButton, 0, 0, 4, 4 );
139 cdUpButton->hide(); 142 cdUpButton->hide();
140 143
141// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); 144// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
142// docButton->setFixedSize( QSize( 20, 20 ) ); 145// docButton->setFixedSize( QSize( 20, 20 ) );
143// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 146// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
144// docButton->setFlat(TRUE); 147// docButton->setFlat(TRUE);
145// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 148// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
146 149
147 homeButton = new QToolButton(view,"homeButton"); 150 homeButton = new QToolButton( view,"homeButton");
148 homeButton->setPixmap( Resource::loadPixmap("home")); 151 homeButton->setPixmap( Resource::loadPixmap("home"));
149 homeButton->setFixedSize( QSize( 20, 20 ) ); 152 homeButton->setFixedSize( QSize( 20, 20 ) );
150 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 153 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
151 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 154 layout->addMultiCellWidget( homeButton, 0, 0, 3, 3);
152 homeButton->hide(); 155 homeButton->hide();
153 156
154 TabWidget = new QTabWidget( view, "TabWidget" ); 157 TabWidget = new QTabWidget( view, "TabWidget" );
155 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 158 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
156 159
157// TabWidget->setTabShape(QTabWidget::Triangular); 160// TabWidget->setTabShape(QTabWidget::Triangular);
158 161
159 tab = new QWidget( TabWidget, "tab" ); 162 tab = new QWidget( TabWidget, "tab" );
160 tabLayout = new QGridLayout( tab ); 163 tabLayout = new QGridLayout( tab );
161 tabLayout->setSpacing( 2); 164 tabLayout->setSpacing( 2);
162 tabLayout->setMargin( 2); 165 tabLayout->setMargin( 2);
163 166
164 Local_View = new QListView( tab, "Local_View" ); 167 Local_View = new QListView( tab, "Local_View" );
165// Local_View->setResizePolicy( QListView::AutoOneFit ); 168// Local_View->setResizePolicy( QListView::AutoOneFit );
166 Local_View->addColumn( tr("File"),150); 169 Local_View->addColumn( tr("File"),150);
167 Local_View->addColumn( tr("Date"),-1); 170 Local_View->addColumn( tr("Date"),-1);
168 Local_View->setColumnAlignment(1,QListView::AlignRight); 171 Local_View->setColumnAlignment(1,QListView::AlignRight);
169 Local_View->addColumn( tr("Size"),-1); 172 Local_View->addColumn( tr("Size"),-1);
170 Local_View->setColumnAlignment(2,QListView::AlignRight); 173 Local_View->setColumnAlignment(2,QListView::AlignRight);
171 Local_View->setAllColumnsShowFocus(TRUE); 174 Local_View->setAllColumnsShowFocus(TRUE);
172 175
173 Local_View->setMultiSelection( TRUE); 176 Local_View->setMultiSelection( TRUE);
174 Local_View->setSelectionMode(QListView::Extended); 177 Local_View->setSelectionMode(QListView::Extended);
175 Local_View->setFocusPolicy(QWidget::ClickFocus); 178 Local_View->setFocusPolicy(QWidget::ClickFocus);
176 179
177 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 180 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
178 181
179 tabLayout->addWidget( Local_View, 0, 0 ); 182 tabLayout->addWidget( Local_View, 0, 0 );
180 183
181 connect( Local_View, SIGNAL( clicked(QListViewItem*)), 184 connect( Local_View, SIGNAL( clicked(QListViewItem*)),
182 this,SLOT( localListClicked(QListViewItem*)) ); 185 this,SLOT( localListClicked(QListViewItem*)) );
183// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), 186// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)),
184// this,SLOT( localListClicked(QListViewItem*)) ); 187// this,SLOT( localListClicked(QListViewItem*)) );
185 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), 188 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
186 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); 189 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
187 190
188 TabWidget->insertTab( tab, tr( "Local" ) ); 191 TabWidget->insertTab( tab, tr( "Local" ) );
189 192
190 tab_2 = new QWidget( TabWidget, "tab_2" ); 193 tab_2 = new QWidget( TabWidget, "tab_2" );
191 tabLayout_2 = new QGridLayout( tab_2 ); 194 tabLayout_2 = new QGridLayout( tab_2 );
192 tabLayout_2->setSpacing( 2); 195 tabLayout_2->setSpacing( 2);
193 tabLayout_2->setMargin( 2); 196 tabLayout_2->setMargin( 2);
194 197
195 Remote_View = new QListView( tab_2, "Remote_View" ); 198 Remote_View = new QListView( tab_2, "Remote_View" );
196 Remote_View->addColumn( tr("File"),150); 199 Remote_View->addColumn( tr("File"),150);
197 Remote_View->addColumn( tr("Date"),-1); 200 Remote_View->addColumn( tr("Date"),-1);
198// Remote_View->setColumnAlignment(1,QListView::AlignRight); 201// Remote_View->setColumnAlignment(1,QListView::AlignRight);
199 Remote_View->addColumn( tr("Size"),-1); 202 Remote_View->addColumn( tr("Size"),-1);
200 Remote_View->setColumnAlignment(2,QListView::AlignRight); 203 Remote_View->setColumnAlignment(2,QListView::AlignRight);
@@ -207,96 +210,99 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
207 Remote_View->setSelectionMode(QListView::Extended); 210 Remote_View->setSelectionMode(QListView::Extended);
208 Remote_View->setFocusPolicy(QWidget::ClickFocus); 211 Remote_View->setFocusPolicy(QWidget::ClickFocus);
209 212
210 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 213 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
211 214
212 connect( Remote_View, SIGNAL( clicked(QListViewItem*)), 215 connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
213 this,SLOT( remoteListClicked(QListViewItem*)) ); 216 this,SLOT( remoteListClicked(QListViewItem*)) );
214 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), 217 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
215 this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); 218 this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) );
216 219
217 tabLayout_2->addWidget( Remote_View, 0, 0 ); 220 tabLayout_2->addWidget( Remote_View, 0, 0 );
218 221
219 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 222 TabWidget->insertTab( tab_2, tr( "Remote" ) );
220 223
221 tab_3 = new QWidget( TabWidget, "tab_3" ); 224 tab_3 = new QWidget( TabWidget, "tab_3" );
222 tabLayout_3 = new QGridLayout( tab_3 ); 225 tabLayout_3 = new QGridLayout( tab_3 );
223 tabLayout_3->setSpacing( 2); 226 tabLayout_3->setSpacing( 2);
224 tabLayout_3->setMargin( 2); 227 tabLayout_3->setMargin( 2);
225 228
226 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 229 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
227 TextLabel1->setText( tr( "Username" ) ); 230 TextLabel1->setText( tr( "Username" ) );
228 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 231 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
229 232
230 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 233 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
231 UsernameComboBox->setEditable(TRUE); 234 UsernameComboBox->setEditable(TRUE);
232 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 235 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
233 236
234 connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, 237 connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this,
235 SLOT( UsernameComboBoxEdited(const QString&) )); 238 SLOT( UsernameComboBoxEdited(const QString&) ));
236 239
237 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 240 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
238 TextLabel2->setText( tr( "Password" ) ); 241 TextLabel2->setText( tr( "Password" ) );
239 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 242 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
240 243
241 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 244 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
242 PasswordEdit->setEchoMode(QLineEdit::Password); 245 PasswordEdit->setEchoMode(QLineEdit::Password);
243 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 246 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
244 247
245 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, 248 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this,
246 SLOT( PasswordEditEdited(const QString&) )); 249 SLOT( PasswordEditEdited(const QString&) ));
247 250
248//PasswordEdit->setFixedWidth(85); 251//PasswordEdit->setFixedWidth(85);
249 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 252 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
250 TextLabel3->setText( tr( "Remote server" ) ); 253 TextLabel3->setText( tr( "Remote server" ) );
251 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 254 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
252 255
253 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 256 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
254 ServerComboBox->setEditable(TRUE); 257 ServerComboBox->setEditable(TRUE);
258 ServerComboBox->setAutoCompletion(true);
259 // ServerComboBox->blockSignals(true);
260
255 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 261 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
256 262
257 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); 263 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) ));
258 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, 264 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this,
259 SLOT(serverComboEdited(const QString&) )); 265 SLOT(serverComboEdited(const QString&) ));
260 266
261 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 267 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
262 TextLabel5->setText( tr( "Remote path" ) ); 268 TextLabel5->setText( tr( "Remote path" ) );
263 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 269 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
264 270
265 271
266 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 272 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
267 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 273 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
268 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 274 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
269 TextLabel4->setText( tr( "Port" ) ); 275 TextLabel4->setText( tr( "Port" ) );
270 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 276 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
271 277
272 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 278 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
273 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 279 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
274 PortSpinBox->setMaxValue(32786); 280 PortSpinBox->setMaxValue(32786);
275 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 281 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
276 282
277 serverListView = new QListBox( tab_3, "ServerListView" ); 283 serverListView = new QListBox( tab_3, "ServerListView" );
278 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 284 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
279 285
280 connect( serverListView, SIGNAL( highlighted(const QString&)), 286 connect( serverListView, SIGNAL( highlighted(const QString&)),
281 this,SLOT( serverListClicked(const QString&) ) ); 287 this,SLOT( serverListClicked(const QString&) ) );
282 288
283 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); 289 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
284 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 290 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
285 connectServerBtn->setToggleButton(TRUE); 291 connectServerBtn->setToggleButton(TRUE);
286 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); 292 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) ));
287 293
288 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); 294 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
289 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 295 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
290 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 296 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
291 297
292 QPushButton *deleteServerBtn; 298 QPushButton *deleteServerBtn;
293 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); 299 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
294 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 300 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
295 301
296 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 302 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
297 303
298 304
299 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 305 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
300 tabLayout_3->addItem( spacer, 5, 0 ); 306 tabLayout_3->addItem( spacer, 5, 0 );
301 307
302 TabWidget->insertTab( tab_3, tr( "Config" ) ); 308 TabWidget->insertTab( tab_3, tr( "Config" ) );
@@ -1281,139 +1287,146 @@ void OpieFtp::clearCombos() {
1281 odebug << "clearing" << oendl; 1287 odebug << "clearing" << oendl;
1282 ServerComboBox->clear(); 1288 ServerComboBox->clear();
1283 UsernameComboBox->clear(); 1289 UsernameComboBox->clear();
1284 PasswordEdit->clear(); 1290 PasswordEdit->clear();
1285 serverListView->clear(); 1291 serverListView->clear();
1286} 1292}
1287 1293
1288 1294
1289void OpieFtp::fillCombos() 1295void OpieFtp::fillCombos()
1290{ 1296{
1291 clearCombos(); 1297 clearCombos();
1292 qDebug("did we get here yet?"); 1298 qDebug("did we get here yet?");
1293 1299
1294 Config cfg("opieftp"); 1300 Config cfg("opieftp");
1295 cfg.setGroup("Server"); 1301 cfg.setGroup("Server");
1296 QString username, remoteServerStr, remotePathStr, password, port, temp; 1302 QString username, remoteServerStr, remotePathStr, password, port, temp;
1297 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1303 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1298 1304
1299 for (int i = 1; i <= numberOfEntries; i++) { 1305 for (int i = 1; i <= numberOfEntries; i++) {
1300 temp.setNum(i); 1306 temp.setNum(i);
1301 odebug << temp << oendl; 1307 odebug << temp << oendl;
1302 cfg.setGroup("Server"); 1308 cfg.setGroup("Server");
1303 remoteServerStr = cfg.readEntry( temp,""); 1309 remoteServerStr = cfg.readEntry( temp,"");
1304 odebug << remoteServerStr << oendl; 1310 odebug << remoteServerStr << oendl;
1305 1311
1306 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1312 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1307 port = remoteServerStr.right( divider - 1); 1313 port = remoteServerStr.right( divider - 1);
1308 bool ok; 1314 bool ok;
1309 PortSpinBox->setValue( port.toInt(&ok,10)); 1315 PortSpinBox->setValue( port.toInt(&ok,10));
1310 1316
1311 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1317 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1312 odebug << "remote server string "+remoteServerStr << oendl; 1318 odebug << "remote server string "+remoteServerStr << oendl;
1313 ServerComboBox->insertItem( remoteServerStr ); 1319 ServerComboBox->insertItem( remoteServerStr );
1314 1320
1315 cfg.setGroup(temp); 1321 cfg.setGroup(temp);
1316 1322
1317 username = cfg.readEntry(temp); 1323 username = cfg.readEntry(temp);
1318 UsernameComboBox->insertItem(username); 1324 UsernameComboBox->insertItem(username);
1319 password = cfg.readEntryCrypt(username,""); 1325 password = cfg.readEntryCrypt(username,"");
1320 PasswordEdit->setText(password); 1326 PasswordEdit->setText(password);
1321 1327
1322 serverListView->insertItem( cfg.readEntry("ServerName")); 1328 serverListView->insertItem( cfg.readEntry("ServerName"));
1323 } 1329 }
1324} 1330}
1325 1331
1326 1332
1327void OpieFtp::serverComboSelected(int index) 1333void OpieFtp::serverComboSelected(int index)
1328{ 1334{
1335 QString servername;
1329 currentServerConfig = index+1; 1336 currentServerConfig = index+1;
1330 odebug << "server combo selected " << index+1 << "" << oendl; 1337 odebug << "server combo selected " << index + 1 << "" << oendl;
1331 QString username, remoteServerStr, remotePathStr, password, port, temp; 1338 QString username, remoteServerStr, remotePathStr, password, port, temp;
1332// remoteServerStr = ServerComboBox->text(index); 1339 servername = remoteServerStr = ServerComboBox->text(index);
1340 qDebug("server text " + remoteServerStr);
1333 1341
1334 Config cfg("opieftp"); 1342 Config cfg("opieftp");
1335 cfg.setGroup("Server"); 1343 cfg.setGroup("Server");
1336// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1344// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1337 1345
1338 temp.setNum(index+1); 1346 // for (int i = 1; i <= numberOfEntries; i++) {
1347// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1348
1349 temp.setNum(index + 1);
1339 remoteServerStr = cfg.readEntry( temp,""); 1350 remoteServerStr = cfg.readEntry( temp,"");
1340 1351
1341 odebug << "Group" +temp << oendl; 1352 odebug << "Group " +temp << oendl;
1342 cfg.setGroup(temp); 1353 cfg.setGroup(temp);
1343// odebug << temp << oendl; 1354
1344 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1355 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1345 port = remoteServerStr.right( divider - 1); 1356 port = remoteServerStr.right( divider - 1);
1346 bool ok; 1357 bool ok;
1347 int portInt = port.toInt(&ok,10); 1358 int portInt = port.toInt(&ok,10);
1348 if( portInt == 0) portInt = 21; 1359 if( portInt == 0) portInt = 21;
1349
1350 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1360 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1351 1361
1352 PortSpinBox->setValue( portInt); 1362 PortSpinBox->setValue( portInt);
1353 1363
1354 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1364 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1355 1365
1356 username = cfg.readEntry("Username", "anonymous"); 1366 username = cfg.readEntry("Username", "anonymous");
1357 UsernameComboBox->lineEdit()->setText(username); 1367 UsernameComboBox->lineEdit()->setText(username);
1358 odebug << username << oendl; 1368 odebug << username << oendl;
1359// odebug << "Password is "+cfg.readEntryCrypt(username << oendl; 1369// odebug << "Password is "+cfg.readEntryCrypt(username << oendl;
1360 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1370 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1361// UsernameComboBox 1371// UsernameComboBox
1362// PasswordEdit 1372// PasswordEdit
1363 1373
1364 cfg.setGroup("Server"); 1374 cfg.setGroup("Server");
1365 temp.sprintf("%d",currentServerConfig); 1375 temp.sprintf("%d", currentServerConfig);
1366 cfg.writeEntry("currentServer", temp); 1376 cfg.writeEntry("currentServer", temp);
1377 cfg.writeEntry(temp,servername);
1367 1378
1379
1368 fuckeduphack = TRUE; 1380 fuckeduphack = TRUE;
1369 serverListView->setCurrentItem( index); 1381 serverListView->setCurrentItem( index);
1370 fuckeduphack=FALSE; 1382 fuckeduphack = FALSE;
1371 odebug << "server list set selected " << index << "" << oendl; 1383 qDebug( "server list set selected %d "+temp, index);
1384 ServerComboBox->lineEdit()->setText(servername);
1372 update(); 1385 update();
1373} 1386}
1374 1387
1375void OpieFtp::deleteServer() 1388void OpieFtp::deleteServer()
1376{ 1389{
1377 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1390 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1378 remoteServerStr = ServerComboBox->currentText( ); 1391 remoteServerStr = ServerComboBox->currentText( );
1379 username = UsernameComboBox->currentText(); 1392 username = UsernameComboBox->currentText();
1380 servername=serverListView->currentText(); 1393 servername=serverListView->currentText();
1381 1394
1382 Config cfg("opieftp"); 1395 Config cfg("opieftp");
1383 cfg.setGroup("Server"); 1396 cfg.setGroup("Server");
1384 QString tempname; 1397 QString tempname;
1385 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1398 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1386 1399
1387 for (int i = 1; i <= numberOfEntries; i++) { 1400 for (int i = 1; i <= numberOfEntries; i++) {
1388 temp.setNum(i); 1401 temp.setNum(i);
1389// cfg.setGroup("Server"); 1402// cfg.setGroup("Server");
1390 cfg.setGroup(QString::number(i)); 1403 cfg.setGroup(QString::number(i));
1391 tempname=cfg.readEntry( "ServerName",""); 1404 tempname=cfg.readEntry( "ServerName","");
1392 1405
1393 if( tempname.find( servername,0,TRUE) != -1 ) { 1406 if( tempname.find( servername,0,TRUE) != -1 ) {
1394// servername.find( cfg.readEntry("ServerName")) != -1 && 1407// servername.find( cfg.readEntry("ServerName")) != -1 &&
1395// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && 1408// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1396// username.find( cfg.readEntry("Username")) != -1) { 1409// username.find( cfg.readEntry("Username")) != -1) {
1397 1410
1398 serverListView->removeItem(i); 1411 serverListView->removeItem(i);
1399 1412
1400 odebug << "OK DELETE "+tempname << oendl; 1413 odebug << "OK DELETE "+tempname << oendl;
1401 cfg.removeEntry(QString::number(i)); 1414 cfg.removeEntry(QString::number(i));
1402 for ( ; i <= numberOfEntries; i++) { 1415 for ( ; i <= numberOfEntries; i++) {
1403 cfg.setGroup("Server"); 1416 cfg.setGroup("Server");
1404 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); 1417 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1405 1418
1406 cfg.setGroup(QString::number(i+1)); //get next server config 1419 cfg.setGroup(QString::number(i+1)); //get next server config
1407 servername=cfg.readEntry("ServerName"); 1420 servername=cfg.readEntry("ServerName");
1408 remoteServerStr=cfg.readEntry("RemotePath"); 1421 remoteServerStr=cfg.readEntry("RemotePath");
1409 username=cfg.readEntry("Username"); 1422 username=cfg.readEntry("Username");
1410 password=cfg.readEntryCrypt( username); 1423 password=cfg.readEntryCrypt( username);
1411 1424
1412 cfg.setGroup(QString::number(i)); 1425 cfg.setGroup(QString::number(i));
1413 1426
1414 cfg.writeEntry("RemotePath", remoteServerStr); 1427 cfg.writeEntry("RemotePath", remoteServerStr);
1415 cfg.writeEntry("ServerName", servername); 1428 cfg.writeEntry("ServerName", servername);
1416 cfg.writeEntry("Username", username); 1429 cfg.writeEntry("Username", username);
1417 cfg.writeEntryCrypt( username, password); 1430 cfg.writeEntryCrypt( username, password);
1418 1431
1419 } 1432 }