author | llornkcor <llornkcor> | 2002-10-18 00:07:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-18 00:07:20 (UTC) |
commit | e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6 (patch) (unidiff) | |
tree | 4c8e6cec21577de93127658b730d3685d5f62b90 | |
parent | e688f02fa2d750eca01c92435d8793ba17aa050a (diff) | |
download | opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.zip opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.tar.gz opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.tar.bz2 |
patch by Ben Jackson, and changed listview alignment
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4e14946..3d97ecb 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -97,195 +97,196 @@ OpieFtp::OpieFtp( ) | |||
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() )); |
115 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 115 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
116 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 116 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
117 | remoteMenu->insertSeparator(); | 117 | remoteMenu->insertSeparator(); |
118 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 118 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
119 | 119 | ||
120 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 120 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
121 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 121 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
122 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 122 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
123 | tabMenu->insertSeparator(); | 123 | tabMenu->insertSeparator(); |
124 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 124 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
125 | tabMenu->setCheckable(TRUE); | 125 | tabMenu->setCheckable(TRUE); |
126 | 126 | ||
127 | 127 | ||
128 | 128 | ||
129 | cdUpButton = new QToolButton( this,"cdUpButton"); | 129 | cdUpButton = new QToolButton( this,"cdUpButton"); |
130 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 130 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
131 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 131 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
132 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 132 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
133 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 133 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
134 | cdUpButton->hide(); | 134 | cdUpButton->hide(); |
135 | 135 | ||
136 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 136 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
137 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 137 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
138 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 138 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
139 | // docButton->setFlat(TRUE); | 139 | // docButton->setFlat(TRUE); |
140 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 140 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
141 | 141 | ||
142 | homeButton = new QToolButton(this,"homeButton"); | 142 | homeButton = new QToolButton(this,"homeButton"); |
143 | homeButton->setPixmap( Resource::loadPixmap("home")); | 143 | homeButton->setPixmap( Resource::loadPixmap("home")); |
144 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 144 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
145 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 145 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
146 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 146 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
147 | homeButton->hide(); | 147 | homeButton->hide(); |
148 | 148 | ||
149 | TabWidget = new QTabWidget( this, "TabWidget" ); | 149 | TabWidget = new QTabWidget( this, "TabWidget" ); |
150 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 150 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
151 | 151 | ||
152 | // TabWidget->setTabShape(QTabWidget::Triangular); | 152 | // TabWidget->setTabShape(QTabWidget::Triangular); |
153 | 153 | ||
154 | tab = new QWidget( TabWidget, "tab" ); | 154 | tab = new QWidget( TabWidget, "tab" ); |
155 | tabLayout = new QGridLayout( tab ); | 155 | tabLayout = new QGridLayout( tab ); |
156 | tabLayout->setSpacing( 2); | 156 | tabLayout->setSpacing( 2); |
157 | tabLayout->setMargin( 2); | 157 | tabLayout->setMargin( 2); |
158 | 158 | ||
159 | Local_View = new QListView( tab, "Local_View" ); | 159 | Local_View = new QListView( tab, "Local_View" ); |
160 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 160 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
161 | Local_View->addColumn( tr("File"),150); | 161 | Local_View->addColumn( tr("File"),150); |
162 | Local_View->addColumn( tr("Date"),-1); | 162 | Local_View->addColumn( tr("Date"),-1); |
163 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 163 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
164 | Local_View->addColumn( tr("Size"),-1); | 164 | Local_View->addColumn( tr("Size"),-1); |
165 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 165 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
166 | Local_View->setAllColumnsShowFocus(TRUE); | 166 | Local_View->setAllColumnsShowFocus(TRUE); |
167 | 167 | ||
168 | Local_View->setMultiSelection( TRUE); | 168 | Local_View->setMultiSelection( TRUE); |
169 | Local_View->setSelectionMode(QListView::Extended); | 169 | Local_View->setSelectionMode(QListView::Extended); |
170 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 170 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
171 | 171 | ||
172 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 172 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
173 | 173 | ||
174 | tabLayout->addWidget( Local_View, 0, 0 ); | 174 | tabLayout->addWidget( Local_View, 0, 0 ); |
175 | 175 | ||
176 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 176 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
177 | this,SLOT( localListClicked(QListViewItem *)) ); | 177 | this,SLOT( localListClicked(QListViewItem *)) ); |
178 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 178 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
179 | // this,SLOT( localListClicked(QListViewItem *)) ); | 179 | // this,SLOT( localListClicked(QListViewItem *)) ); |
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->setColumnAlignment(3,QListView::AlignCenter); | ||
196 | Remote_View->addColumn( tr("Dir"),-1); | 197 | Remote_View->addColumn( tr("Dir"),-1); |
197 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 198 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
198 | Remote_View->setAllColumnsShowFocus(TRUE); | 199 | Remote_View->setAllColumnsShowFocus(TRUE); |
199 | 200 | ||
200 | Remote_View->setMultiSelection( FALSE); | 201 | Remote_View->setMultiSelection( FALSE); |
201 | Remote_View->setSelectionMode(QListView::Extended); | 202 | Remote_View->setSelectionMode(QListView::Extended); |
202 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 203 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
203 | 204 | ||
204 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 205 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
205 | 206 | ||
206 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 207 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
207 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 208 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
208 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 209 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
209 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 210 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
210 | 211 | ||
211 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 212 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
212 | 213 | ||
213 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 214 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
214 | 215 | ||
215 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 216 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
216 | tabLayout_3 = new QGridLayout( tab_3 ); | 217 | tabLayout_3 = new QGridLayout( tab_3 ); |
217 | tabLayout_3->setSpacing( 2); | 218 | tabLayout_3->setSpacing( 2); |
218 | tabLayout_3->setMargin( 2); | 219 | tabLayout_3->setMargin( 2); |
219 | 220 | ||
220 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 221 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
221 | TextLabel1->setText( tr( "Username" ) ); | 222 | TextLabel1->setText( tr( "Username" ) ); |
222 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 223 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
223 | 224 | ||
224 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 225 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
225 | UsernameComboBox->setEditable(TRUE); | 226 | UsernameComboBox->setEditable(TRUE); |
226 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 227 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
227 | 228 | ||
228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, | 229 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, |
229 | SLOT( UsernameComboBoxEdited(const QString & ) )); | 230 | SLOT( UsernameComboBoxEdited(const QString & ) )); |
230 | 231 | ||
231 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 232 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
232 | TextLabel2->setText( tr( "Password" ) ); | 233 | TextLabel2->setText( tr( "Password" ) ); |
233 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 234 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
234 | 235 | ||
235 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 236 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
236 | PasswordEdit->setEchoMode(QLineEdit::Password); | 237 | PasswordEdit->setEchoMode(QLineEdit::Password); |
237 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 238 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
238 | 239 | ||
239 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, | 240 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, |
240 | SLOT( PasswordEditEdited(const QString & ) )); | 241 | SLOT( PasswordEditEdited(const QString & ) )); |
241 | 242 | ||
242 | //PasswordEdit->setFixedWidth(85); | 243 | //PasswordEdit->setFixedWidth(85); |
243 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 244 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
244 | TextLabel3->setText( tr( "Remote server" ) ); | 245 | TextLabel3->setText( tr( "Remote server" ) ); |
245 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 246 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
246 | 247 | ||
247 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 248 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
248 | ServerComboBox->setEditable(TRUE); | 249 | ServerComboBox->setEditable(TRUE); |
249 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 250 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
250 | 251 | ||
251 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 252 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
252 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, | 253 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, |
253 | SLOT(serverComboEdited(const QString & ) )); | 254 | SLOT(serverComboEdited(const QString & ) )); |
254 | 255 | ||
255 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 256 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
256 | TextLabel5->setText( tr( "Remote path" ) ); | 257 | TextLabel5->setText( tr( "Remote path" ) ); |
257 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 258 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
258 | 259 | ||
259 | 260 | ||
260 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 261 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
261 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 262 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
262 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 263 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
263 | TextLabel4->setText( tr( "Port" ) ); | 264 | TextLabel4->setText( tr( "Port" ) ); |
264 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 265 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
265 | 266 | ||
266 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 267 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
267 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 268 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
268 | PortSpinBox->setMaxValue(32786); | 269 | PortSpinBox->setMaxValue(32786); |
269 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 270 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
270 | 271 | ||
271 | serverListView = new QListBox( tab_3, "ServerListView" ); | 272 | serverListView = new QListBox( tab_3, "ServerListView" ); |
272 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 273 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
273 | 274 | ||
274 | connect( serverListView, SIGNAL( highlighted( const QString &)), | 275 | connect( serverListView, SIGNAL( highlighted( const QString &)), |
275 | this,SLOT( serverListClicked( const QString &) ) ); | 276 | this,SLOT( serverListClicked( const QString &) ) ); |
276 | 277 | ||
277 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 278 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
278 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 279 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
279 | connectServerBtn->setToggleButton(TRUE); | 280 | connectServerBtn->setToggleButton(TRUE); |
280 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 281 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
281 | 282 | ||
282 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); | 283 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); |
283 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 284 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
284 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 285 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
285 | 286 | ||
286 | QPushButton *deleteServerBtn; | 287 | QPushButton *deleteServerBtn; |
287 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); | 288 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); |
288 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 289 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
289 | 290 | ||
290 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 291 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
291 | 292 | ||
@@ -628,222 +629,224 @@ bool OpieFtp::remoteChDir(const QString &dir) | |||
628 | { | 629 | { |
629 | // QCopEnvelope ( "QPE/System", "busy()" ); | 630 | // QCopEnvelope ( "QPE/System", "busy()" ); |
630 | if (!FtpChdir( dir.latin1(), conn )) { | 631 | if (!FtpChdir( dir.latin1(), conn )) { |
631 | QString msg; | 632 | QString msg; |
632 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 633 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
633 | msg.replace(QRegExp(":"),"\n"); | 634 | msg.replace(QRegExp(":"),"\n"); |
634 | QMessageBox::message(tr("Note"),msg); | 635 | QMessageBox::message(tr("Note"),msg); |
635 | // qDebug(msg); | 636 | // qDebug(msg); |
636 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 637 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
637 | return FALSE; | 638 | return FALSE; |
638 | } | 639 | } |
639 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 640 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
640 | return TRUE; | 641 | return TRUE; |
641 | } | 642 | } |
642 | 643 | ||
643 | void OpieFtp::populateLocalView() | 644 | void OpieFtp::populateLocalView() |
644 | { | 645 | { |
645 | Local_View->clear(); | 646 | Local_View->clear(); |
646 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 647 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
647 | currentDir.setMatchAllDirs(TRUE); | 648 | currentDir.setMatchAllDirs(TRUE); |
648 | currentDir.setNameFilter(filterStr); | 649 | currentDir.setNameFilter(filterStr); |
649 | QString fileL, fileS, fileDate; | 650 | QString fileL, fileS, fileDate; |
650 | bool isDir=FALSE; | 651 | bool isDir=FALSE; |
651 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 652 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
652 | QFileInfoListIterator it(*list); | 653 | QFileInfoListIterator it(*list); |
653 | QFileInfo *fi; | 654 | QFileInfo *fi; |
654 | while ( (fi=it.current()) ) { | 655 | while ( (fi=it.current()) ) { |
655 | if (fi->isSymLink() ){ | 656 | if (fi->isSymLink() ){ |
656 | QString symLink=fi->readLink(); | 657 | QString symLink=fi->readLink(); |
657 | // qDebug("Symlink detected "+symLink); | 658 | // qDebug("Symlink detected "+symLink); |
658 | QFileInfo sym( symLink); | 659 | QFileInfo sym( symLink); |
659 | fileS.sprintf( "%10i", sym.size() ); | 660 | fileS.sprintf( "%10i", sym.size() ); |
660 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 661 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
661 | fileDate = sym.lastModified().toString(); | 662 | fileDate = sym.lastModified().toString(); |
662 | } else { | 663 | } else { |
663 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 664 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
664 | fileS.sprintf( "%10i", fi->size() ); | 665 | fileS.sprintf( "%10i", fi->size() ); |
665 | fileL.sprintf( "%s",fi->fileName().data() ); | 666 | fileL.sprintf( "%s",fi->fileName().data() ); |
666 | fileDate= fi->lastModified().toString(); | 667 | fileDate= fi->lastModified().toString(); |
667 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 668 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
668 | fileL+="/"; | 669 | fileL+="/"; |
669 | isDir=TRUE; | 670 | isDir=TRUE; |
670 | // qDebug( fileL); | 671 | // qDebug( fileL); |
671 | } | 672 | } |
672 | } | 673 | } |
673 | if(fileL !="./" && fi->exists()) { | 674 | if(fileL !="./" && fi->exists()) { |
674 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); | 675 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
675 | QPixmap pm; | 676 | QPixmap pm; |
676 | 677 | ||
677 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 678 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
678 | if( !QDir( fi->filePath() ).isReadable()) | 679 | if( !QDir( fi->filePath() ).isReadable()) |
679 | pm = Resource::loadPixmap( "lockedfolder" ); | 680 | pm = Resource::loadPixmap( "lockedfolder" ); |
680 | else | 681 | else |
681 | pm= Resource::loadPixmap( "folder" ); | 682 | pm= Resource::loadPixmap( "folder" ); |
682 | item->setPixmap( 0,pm ); | 683 | item->setPixmap( 0,pm ); |
683 | } else { | 684 | } else { |
684 | if( !fi->isReadable() ) | 685 | if( !fi->isReadable() ) |
685 | pm = Resource::loadPixmap( "locked" ); | 686 | pm = Resource::loadPixmap( "locked" ); |
686 | else { | 687 | else { |
687 | MimeType mt(fi->filePath()); | 688 | MimeType mt(fi->filePath()); |
688 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 689 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
689 | if(pm.isNull()) | 690 | if(pm.isNull()) |
690 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 691 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
691 | item->setPixmap( 0,pm); | 692 | item->setPixmap( 0,pm); |
692 | } | 693 | } |
693 | } | 694 | } |
694 | if( fileL.find("->",0,TRUE) != -1) { | 695 | if( fileL.find("->",0,TRUE) != -1) { |
695 | // overlay link image | 696 | // overlay link image |
696 | pm= Resource::loadPixmap( "folder" ); | 697 | pm= Resource::loadPixmap( "folder" ); |
697 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 698 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
698 | QPainter painter( &pm ); | 699 | QPainter painter( &pm ); |
699 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 700 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
700 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 701 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
701 | item->setPixmap( 0, pm); | 702 | item->setPixmap( 0, pm); |
702 | } | 703 | } |
703 | } | 704 | } |
704 | isDir=FALSE; | 705 | isDir=FALSE; |
705 | ++it; | 706 | ++it; |
706 | } | 707 | } |
707 | Local_View->setSorting( 3,FALSE); | 708 | Local_View->setSorting( 3,FALSE); |
708 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 709 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
709 | fillCombo( (const QString &)currentDir); | 710 | fillCombo( (const QString &)currentDir); |
710 | } | 711 | } |
711 | 712 | ||
712 | bool OpieFtp::populateRemoteView( ) | 713 | bool OpieFtp::populateRemoteView( ) |
713 | { | 714 | { |
714 | // qDebug("populate remoteview"); | 715 | // qDebug("populate remoteview"); |
715 | QString sfile=QDir::homeDirPath(); | 716 | QString sfile=QDir::homeDirPath(); |
716 | if(sfile.right(1) != "/") | 717 | if(sfile.right(1) != "/") |
717 | sfile+="/._temp"; | 718 | sfile+="/._temp"; |
718 | else | 719 | else |
719 | sfile+="._temp"; | 720 | sfile+="._temp"; |
720 | QFile file( sfile); | 721 | QFile file( sfile); |
721 | Remote_View->clear(); | 722 | Remote_View->clear(); |
722 | QString s, File_Name; | 723 | QString s, File_Name; |
723 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 724 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
725 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | ||
724 | QString fileL, fileS, fileDate; | 726 | QString fileL, fileS, fileDate; |
725 | if ( file.open(IO_ReadOnly)) { | 727 | if ( file.open(IO_ReadOnly)) { |
726 | QTextStream t( &file ); // use a text stream | 728 | QTextStream t( &file ); // use a text stream |
727 | while ( !t.eof()) { | 729 | while ( !t.eof()) { |
728 | s = t.readLine(); | 730 | s = t.readLine(); |
729 | fileL = s.right(s.length()-55); | 731 | |
730 | fileL = fileL.stripWhiteSpace(); | 732 | if(s.find("total",0,TRUE) == 0) |
733 | continue; | ||
734 | |||
735 | int len, month = monthRe.match(s, 0, &len); | ||
736 | fileDate = s.mid(month + 1, len - 2); // minus spaces | ||
737 | fileL = s.right(s.length() - month - len); | ||
731 | if(s.left(1) == "d") | 738 | if(s.left(1) == "d") |
732 | fileL = fileL+"/"; | 739 | fileL = fileL+"/"; |
733 | // fileL = "/"+fileL+"/"; | 740 | fileS = s.mid(month - 8, 8); // FIXME |
734 | fileS = s.mid( 30, 42-30); | ||
735 | fileS = fileS.stripWhiteSpace(); | 741 | fileS = fileS.stripWhiteSpace(); |
736 | fileDate = s.mid( 42, 55-42); | 742 | |
737 | fileDate = fileDate.stripWhiteSpace(); | 743 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
738 | if(fileL.find("total",0,TRUE) == -1) { | 744 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
739 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 745 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
740 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | ||
741 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | ||
742 | // if(itemDir) | 746 | // if(itemDir) |
743 | item->moveItem(itemDir); | 747 | item->moveItem(itemDir); |
744 | itemDir=item; | 748 | itemDir=item; |
745 | } else { | 749 | } else { |
746 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 750 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
747 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 751 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
748 | // if(itemFile) | 752 | // if(itemFile) |
749 | item->moveItem(itemDir); | 753 | item->moveItem(itemDir); |
750 | item->moveItem(itemFile); | 754 | item->moveItem(itemFile); |
751 | itemFile=item; | 755 | itemFile=item; |
752 | } | 756 | } |
753 | } | ||
754 | } | 757 | } |
755 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 758 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
756 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 759 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
757 | file.close(); | 760 | file.close(); |
758 | if( file.exists()) | 761 | if( file.exists()) |
759 | file. remove(); | 762 | file. remove(); |
760 | } else | 763 | } else |
761 | qDebug("temp file not opened successfullly "+sfile); | 764 | qDebug("temp file not opened successfullly "+sfile); |
762 | Remote_View->setSorting( 4,TRUE); | 765 | Remote_View->setSorting( 4,TRUE); |
763 | return true; | 766 | return true; |
764 | } | 767 | } |
765 | 768 | ||
766 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 769 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
767 | { | 770 | { |
768 | if( selectedItem) { | 771 | if( selectedItem) { |
769 | // QCopEnvelope ( "QPE/System", "busy()" ); | 772 | // QCopEnvelope ( "QPE/System", "busy()" ); |
770 | QString oldRemoteCurrentDir = currentRemoteDir; | 773 | QString oldRemoteCurrentDir = currentRemoteDir; |
771 | QString strItem=selectedItem->text(0); | 774 | QString strItem=selectedItem->text(0); |
772 | strItem=strItem.simplifyWhiteSpace(); | 775 | strItem=strItem.simplifyWhiteSpace(); |
773 | if(strItem == "../") { // the user wants to go ^ | 776 | if(strItem == "../") { // the user wants to go ^ |
774 | if( FtpCDUp( conn) == 0) { | 777 | if( FtpCDUp( conn) == 0) { |
775 | QString msg; | 778 | QString msg; |
776 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 779 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
777 | msg.replace(QRegExp(":"),"\n"); | 780 | msg.replace(QRegExp(":"),"\n"); |
778 | QMessageBox::message(tr("Note"),msg); | 781 | QMessageBox::message(tr("Note"),msg); |
779 | // qDebug(msg); | 782 | // qDebug(msg); |
780 | } | 783 | } |
781 | char path[256]; | 784 | char path[256]; |
782 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 785 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
783 | QString msg; | 786 | QString msg; |
784 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 787 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
785 | msg.replace(QRegExp(":"),"\n"); | 788 | msg.replace(QRegExp(":"),"\n"); |
786 | QMessageBox::message(tr("Note"),msg); | 789 | QMessageBox::message(tr("Note"),msg); |
787 | // qDebug(msg); | 790 | // qDebug(msg); |
788 | } | 791 | } |
789 | currentRemoteDir=path; | 792 | currentRemoteDir=path; |
790 | } else { | 793 | } else { |
791 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 794 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
792 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 795 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
793 | strItem = strItem.stripWhiteSpace(); | 796 | strItem = strItem.stripWhiteSpace(); |
794 | currentRemoteDir = strItem; | 797 | currentRemoteDir = strItem; |
795 | if( !remoteChDir( (const QString &)strItem)) { | 798 | if( !remoteChDir( (const QString &)strItem)) { |
796 | currentRemoteDir = oldRemoteCurrentDir; | 799 | currentRemoteDir = oldRemoteCurrentDir; |
797 | strItem=""; | 800 | strItem=""; |
798 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 801 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
799 | } | 802 | } |
800 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 803 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
801 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 804 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
802 | currentRemoteDir = oldRemoteCurrentDir; | 805 | currentRemoteDir = oldRemoteCurrentDir; |
803 | strItem=""; | 806 | strItem=""; |
804 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 807 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
805 | 808 | ||
806 | } else { | 809 | } else { |
807 | currentRemoteDir = currentRemoteDir+strItem; | 810 | currentRemoteDir = currentRemoteDir+strItem; |
808 | } | 811 | } |
809 | } else { | 812 | } else { |
810 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 813 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
811 | return; | 814 | return; |
812 | } | 815 | } |
813 | } | 816 | } |
814 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 817 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
815 | if(currentRemoteDir.right(1) !="/") | 818 | if(currentRemoteDir.right(1) !="/") |
816 | currentRemoteDir +="/"; | 819 | currentRemoteDir +="/"; |
817 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 820 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
818 | fillRemoteCombo( (const QString &)currentRemoteDir); | 821 | fillRemoteCombo( (const QString &)currentRemoteDir); |
819 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 822 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
820 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 823 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
821 | 824 | ||
822 | } | 825 | } |
823 | } | 826 | } |
824 | 827 | ||
825 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 828 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
826 | { | 829 | { |
827 | if(selectedItem!= NULL) { | 830 | if(selectedItem!= NULL) { |
828 | 831 | ||
829 | QString strItem=selectedItem->text(0); | 832 | QString strItem=selectedItem->text(0); |
830 | QString strSize=selectedItem->text(1); | 833 | QString strSize=selectedItem->text(1); |
831 | strSize=strSize.stripWhiteSpace(); | 834 | strSize=strSize.stripWhiteSpace(); |
832 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 835 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
833 | // is symlink | 836 | // is symlink |
834 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 837 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
835 | if(QDir(strItem2).exists() ) { | 838 | if(QDir(strItem2).exists() ) { |
836 | currentDir.cd(strItem2, TRUE); | 839 | currentDir.cd(strItem2, TRUE); |
837 | populateLocalView(); | 840 | populateLocalView(); |
838 | } | 841 | } |
839 | } else { // not a symlink | 842 | } else { // not a symlink |
840 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 843 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
841 | 844 | ||
842 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 845 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
843 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 846 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
844 | currentDir.cd(strItem,FALSE); | 847 | currentDir.cd(strItem,FALSE); |
845 | populateLocalView(); | 848 | populateLocalView(); |
846 | } else { | 849 | } else { |
847 | currentDir.cdUp(); | 850 | currentDir.cdUp(); |
848 | populateLocalView(); | 851 | populateLocalView(); |
849 | } | 852 | } |