-rw-r--r-- | noncore/net/opieftp/filePermissions.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/inputDialog.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/main.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 14 |
4 files changed, 0 insertions, 26 deletions
diff --git a/noncore/net/opieftp/filePermissions.cpp b/noncore/net/opieftp/filePermissions.cpp index ab094db..f545c1f 100644 --- a/noncore/net/opieftp/filePermissions.cpp +++ b/noncore/net/opieftp/filePermissions.cpp | |||
@@ -1,276 +1,272 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** copyright 2002 ljp ljp@llornkcor.com | 2 | ** copyright 2002 ljp ljp@llornkcor.com |
3 | ** Created: Sat Feb 23 19:44:40 2002 L.J. Potter | 3 | ** Created: Sat Feb 23 19:44:40 2002 L.J. Potter |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #include "filePermissions.h" | 14 | #include "filePermissions.h" |
15 | 15 | ||
16 | #include <qfile.h> | ||
17 | #include <qfileinfo.h> | 16 | #include <qfileinfo.h> |
18 | 17 | ||
19 | #include <qcheckbox.h> | 18 | #include <qcheckbox.h> |
20 | #include <qlabel.h> | 19 | #include <qlabel.h> |
21 | #include <qlineedit.h> | 20 | #include <qlineedit.h> |
22 | #include <qlayout.h> | ||
23 | #include <qvariant.h> | ||
24 | #include <qtooltip.h> | ||
25 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
26 | 22 | ||
27 | #include <unistd.h> | 23 | #include <unistd.h> |
28 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
29 | #include <stdlib.h> | 25 | #include <stdlib.h> |
30 | #include <sys/types.h> | 26 | #include <sys/types.h> |
31 | #include <pwd.h> | 27 | #include <pwd.h> |
32 | #include <grp.h> | 28 | #include <grp.h> |
33 | 29 | ||
34 | filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) | 30 | filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) |
35 | : QDialog( parent, name, modal, fl ) | 31 | : QDialog( parent, name, modal, fl ) |
36 | { | 32 | { |
37 | if ( !name ) | 33 | if ( !name ) |
38 | setName( tr("filePermissions") ); | 34 | setName( tr("filePermissions") ); |
39 | // qDebug("FilePermissions "+fileName); | 35 | // qDebug("FilePermissions "+fileName); |
40 | resize( 236, 210 ); | 36 | resize( 236, 210 ); |
41 | isRemote=useRemote; | 37 | isRemote=useRemote; |
42 | setMaximumSize( QSize( 236, 210 ) ); | 38 | setMaximumSize( QSize( 236, 210 ) ); |
43 | setCaption( tr( "Set File Permissions" ) ); | 39 | setCaption( tr( "Set File Permissions" ) ); |
44 | 40 | ||
45 | TextLabel1 = new QLabel( this, "TextLabel1" ); | 41 | TextLabel1 = new QLabel( this, "TextLabel1" ); |
46 | TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); | 42 | TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); |
47 | TextLabel1->setText( tr( "Set file permissions for:" ) ); | 43 | TextLabel1->setText( tr( "Set file permissions for:" ) ); |
48 | 44 | ||
49 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 45 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
50 | LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); | 46 | LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); |
51 | LineEdit1->setReadOnly(true); | 47 | LineEdit1->setReadOnly(true); |
52 | 48 | ||
53 | TextLabel4 = new QLabel( this, "TextLabel4" ); | 49 | TextLabel4 = new QLabel( this, "TextLabel4" ); |
54 | TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) ); | 50 | TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) ); |
55 | TextLabel4->setText( tr( "owner" ) ); | 51 | TextLabel4->setText( tr( "owner" ) ); |
56 | 52 | ||
57 | TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); | 53 | TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); |
58 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); | 54 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); |
59 | TextLabel4_2->setText( tr( "group" ) ); | 55 | TextLabel4_2->setText( tr( "group" ) ); |
60 | 56 | ||
61 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); | 57 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); |
62 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); | 58 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); |
63 | TextLabel4_3->setText( tr( "others" ) ); | 59 | TextLabel4_3->setText( tr( "others" ) ); |
64 | 60 | ||
65 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); | 61 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); |
66 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); | 62 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); |
67 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); | 63 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); |
68 | 64 | ||
69 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); | 65 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); |
70 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); | 66 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); |
71 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); | 67 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); |
72 | 68 | ||
73 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); | 69 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); |
74 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); | 70 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); |
75 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); | 71 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); |
76 | 72 | ||
77 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); | 73 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); |
78 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); | 74 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); |
79 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); | 75 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); |
80 | 76 | ||
81 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); | 77 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); |
82 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); | 78 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); |
83 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); | 79 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); |
84 | 80 | ||
85 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); | 81 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); |
86 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); | 82 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); |
87 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); | 83 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); |
88 | 84 | ||
89 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); | 85 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); |
90 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); | 86 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); |
91 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); | 87 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); |
92 | 88 | ||
93 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); | 89 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); |
94 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); | 90 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); |
95 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); | 91 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); |
96 | 92 | ||
97 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); | 93 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); |
98 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); | 94 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); |
99 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); | 95 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); |
100 | 96 | ||
101 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); | 97 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); |
102 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); | 98 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); |
103 | 99 | ||
104 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); | 100 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); |
105 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); | 101 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); |
106 | 102 | ||
107 | TextLabel5 = new QLabel( this, "TextLabel5" ); | 103 | TextLabel5 = new QLabel( this, "TextLabel5" ); |
108 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); | 104 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); |
109 | TextLabel5->setText( tr( "Owner" ) ); | 105 | TextLabel5->setText( tr( "Owner" ) ); |
110 | 106 | ||
111 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); | 107 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); |
112 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); | 108 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); |
113 | TextLabel5_2->setText( tr( "Group" ) ); | 109 | TextLabel5_2->setText( tr( "Group" ) ); |
114 | 110 | ||
115 | ModeLine = new QLineEdit( this, "TextLabelMode" ); | 111 | ModeLine = new QLineEdit( this, "TextLabelMode" ); |
116 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); | 112 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); |
117 | 113 | ||
118 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); | 114 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); |
119 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); | 115 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); |
120 | TextLabel3_2->setText( tr( "read" ) ); | 116 | TextLabel3_2->setText( tr( "read" ) ); |
121 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); | 117 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); |
122 | 118 | ||
123 | TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); | 119 | TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); |
124 | TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); | 120 | TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); |
125 | TextLabel3_2_2->setText( tr( "write" ) ); | 121 | TextLabel3_2_2->setText( tr( "write" ) ); |
126 | TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); | 122 | TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); |
127 | 123 | ||
128 | TextLabel3 = new QLabel( this, "TextLabel3" ); | 124 | TextLabel3 = new QLabel( this, "TextLabel3" ); |
129 | TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); | 125 | TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); |
130 | TextLabel3->setText( tr( "execute" ) ); | 126 | TextLabel3->setText( tr( "execute" ) ); |
131 | TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); | 127 | TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); |
132 | 128 | ||
133 | struct stat buf; | 129 | struct stat buf; |
134 | mode_t mode; | 130 | mode_t mode; |
135 | file = fileName; | 131 | file = fileName; |
136 | QFileInfo fi(file); | 132 | QFileInfo fi(file); |
137 | 133 | ||
138 | LineEdit1->setText( file); | 134 | LineEdit1->setText( file); |
139 | OwnerLineEdit->setText( fi.owner()); | 135 | OwnerLineEdit->setText( fi.owner()); |
140 | GroupLineEdit->setText( fi.group()); | 136 | GroupLineEdit->setText( fi.group()); |
141 | 137 | ||
142 | if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); } | 138 | if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); } |
143 | if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); } | 139 | if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); } |
144 | if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); } | 140 | if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); } |
145 | 141 | ||
146 | if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); } | 142 | if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); } |
147 | if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); } | 143 | if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); } |
148 | if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); } | 144 | if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); } |
149 | 145 | ||
150 | if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); } | 146 | if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); } |
151 | if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); } | 147 | if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); } |
152 | if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); } | 148 | if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); } |
153 | 149 | ||
154 | stat(file.latin1(), &buf); | 150 | stat(file.latin1(), &buf); |
155 | mode = buf.st_mode; | 151 | mode = buf.st_mode; |
156 | modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) ); | 152 | modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) ); |
157 | ModeLine->setText(modeStr); | 153 | ModeLine->setText(modeStr); |
158 | bool ok; | 154 | bool ok; |
159 | i_mode = modeStr.toInt(&ok,10); | 155 | i_mode = modeStr.toInt(&ok,10); |
160 | 156 | ||
161 | } | 157 | } |
162 | 158 | ||
163 | /* | 159 | /* |
164 | * Destroys the object and frees any allocated resources | 160 | * Destroys the object and frees any allocated resources |
165 | */ | 161 | */ |
166 | filePermissions::~filePermissions() | 162 | filePermissions::~filePermissions() |
167 | { | 163 | { |
168 | } | 164 | } |
169 | 165 | ||
170 | 166 | ||
171 | // might this be better as a callback routine??? | 167 | // might this be better as a callback routine??? |
172 | void filePermissions::ownReadCheck() { | 168 | void filePermissions::ownReadCheck() { |
173 | if(CheckBox1->isChecked()) { i_mode +=400; } | 169 | if(CheckBox1->isChecked()) { i_mode +=400; } |
174 | else i_mode -=400; | 170 | else i_mode -=400; |
175 | modeStr.sprintf("0%d",i_mode); | 171 | modeStr.sprintf("0%d",i_mode); |
176 | ModeLine->setText( modeStr); | 172 | ModeLine->setText( modeStr); |
177 | // 0400 | 173 | // 0400 |
178 | } | 174 | } |
179 | 175 | ||
180 | void filePermissions::ownWriteCheck() { | 176 | void filePermissions::ownWriteCheck() { |
181 | if(CheckBox1_2->isChecked()) { i_mode +=200; } | 177 | if(CheckBox1_2->isChecked()) { i_mode +=200; } |
182 | else i_mode -=200; | 178 | else i_mode -=200; |
183 | modeStr.sprintf("0%d",i_mode); | 179 | modeStr.sprintf("0%d",i_mode); |
184 | ModeLine->setText(modeStr); | 180 | ModeLine->setText(modeStr); |
185 | // 0200 | 181 | // 0200 |
186 | } | 182 | } |
187 | 183 | ||
188 | void filePermissions::ownExeCheck() { | 184 | void filePermissions::ownExeCheck() { |
189 | if(CheckBox1_3->isChecked()) { i_mode +=100; } | 185 | if(CheckBox1_3->isChecked()) { i_mode +=100; } |
190 | else i_mode -=100; | 186 | else i_mode -=100; |
191 | modeStr.sprintf("0%d",i_mode); | 187 | modeStr.sprintf("0%d",i_mode); |
192 | ModeLine->setText(modeStr); | 188 | ModeLine->setText(modeStr); |
193 | // 0100 | 189 | // 0100 |
194 | } | 190 | } |
195 | 191 | ||
196 | void filePermissions::grpReadCheck() { | 192 | void filePermissions::grpReadCheck() { |
197 | if(CheckBox1_4->isChecked()) { i_mode +=40; } | 193 | if(CheckBox1_4->isChecked()) { i_mode +=40; } |
198 | else i_mode -=40; | 194 | else i_mode -=40; |
199 | modeStr.sprintf("0%d",i_mode); | 195 | modeStr.sprintf("0%d",i_mode); |
200 | ModeLine->setText(modeStr); | 196 | ModeLine->setText(modeStr); |
201 | // 0040 | 197 | // 0040 |
202 | } | 198 | } |
203 | 199 | ||
204 | void filePermissions::grpWriteCheck() { | 200 | void filePermissions::grpWriteCheck() { |
205 | if(CheckBox1_5->isChecked()) { i_mode +=20; } | 201 | if(CheckBox1_5->isChecked()) { i_mode +=20; } |
206 | else i_mode -=20; | 202 | else i_mode -=20; |
207 | modeStr.sprintf("0%d",i_mode); | 203 | modeStr.sprintf("0%d",i_mode); |
208 | ModeLine->setText(modeStr); | 204 | ModeLine->setText(modeStr); |
209 | // 0020 | 205 | // 0020 |
210 | } | 206 | } |
211 | 207 | ||
212 | void filePermissions::grpExeCheck() { | 208 | void filePermissions::grpExeCheck() { |
213 | if(CheckBox1_6->isChecked()) { i_mode +=10; } | 209 | if(CheckBox1_6->isChecked()) { i_mode +=10; } |
214 | else i_mode -=10; | 210 | else i_mode -=10; |
215 | modeStr.sprintf("0%d",i_mode); | 211 | modeStr.sprintf("0%d",i_mode); |
216 | ModeLine->setText(modeStr); | 212 | ModeLine->setText(modeStr); |
217 | // 0010 | 213 | // 0010 |
218 | } | 214 | } |
219 | 215 | ||
220 | void filePermissions::wrldReadCheck() { | 216 | void filePermissions::wrldReadCheck() { |
221 | if(CheckBox1_7->isChecked()) { i_mode +=4; } | 217 | if(CheckBox1_7->isChecked()) { i_mode +=4; } |
222 | else i_mode -=4; | 218 | else i_mode -=4; |
223 | modeStr.sprintf("0%d",i_mode); | 219 | modeStr.sprintf("0%d",i_mode); |
224 | ModeLine->setText(modeStr); | 220 | ModeLine->setText(modeStr); |
225 | // 0004 | 221 | // 0004 |
226 | } | 222 | } |
227 | 223 | ||
228 | void filePermissions::wrldWriteCheck() { | 224 | void filePermissions::wrldWriteCheck() { |
229 | if(CheckBox1_8->isChecked()) { i_mode +=2; } | 225 | if(CheckBox1_8->isChecked()) { i_mode +=2; } |
230 | else i_mode -=2; | 226 | else i_mode -=2; |
231 | modeStr.sprintf("0%d",i_mode); | 227 | modeStr.sprintf("0%d",i_mode); |
232 | ModeLine->setText(modeStr); | 228 | ModeLine->setText(modeStr); |
233 | // 0002 | 229 | // 0002 |
234 | } | 230 | } |
235 | 231 | ||
236 | void filePermissions::wrldExeCheck() { | 232 | void filePermissions::wrldExeCheck() { |
237 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } | 233 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } |
238 | else i_mode -=1; | 234 | else i_mode -=1; |
239 | modeStr.sprintf("0%d",i_mode); | 235 | modeStr.sprintf("0%d",i_mode); |
240 | ModeLine->setText(modeStr); | 236 | ModeLine->setText(modeStr); |
241 | // 0001 | 237 | // 0001 |
242 | } | 238 | } |
243 | 239 | ||
244 | void filePermissions::accept() { | 240 | void filePermissions::accept() { |
245 | QFileInfo fi(file); | 241 | QFileInfo fi(file); |
246 | struct passwd *pwd=0; | 242 | struct passwd *pwd=0; |
247 | struct group *grp=0; | 243 | struct group *grp=0; |
248 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); | 244 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); |
249 | if(pwd == NULL) { | 245 | if(pwd == NULL) { |
250 | perror("getpwnam"); | 246 | perror("getpwnam"); |
251 | QMessageBox::warning(this,tr("Warning"),tr("Error- no user")); | 247 | QMessageBox::warning(this,tr("Warning"),tr("Error- no user")); |
252 | return; | 248 | return; |
253 | } else { | 249 | } else { |
254 | grp = getgrnam(GroupLineEdit->text().latin1()); | 250 | grp = getgrnam(GroupLineEdit->text().latin1()); |
255 | if(grp==NULL) { | 251 | if(grp==NULL) { |
256 | perror("getgrnam"); | 252 | perror("getgrnam"); |
257 | QMessageBox::warning(this,tr("Warning"),tr("Error- no group")); | 253 | QMessageBox::warning(this,tr("Warning"),tr("Error- no group")); |
258 | return; | 254 | return; |
259 | } | 255 | } |
260 | if( chown( file.latin1(), pwd->pw_uid, grp->gr_gid) <0) { | 256 | if( chown( file.latin1(), pwd->pw_uid, grp->gr_gid) <0) { |
261 | perror("chown"); | 257 | perror("chown"); |
262 | QMessageBox::warning(this,tr("Warning"),tr("Error setting ownership or group")); | 258 | QMessageBox::warning(this,tr("Warning"),tr("Error setting ownership or group")); |
263 | return; | 259 | return; |
264 | } | 260 | } |
265 | bool ok; | 261 | bool ok; |
266 | moder = modeStr.toUInt(&ok,8); | 262 | moder = modeStr.toUInt(&ok,8); |
267 | if (!isRemote) { | 263 | if (!isRemote) { |
268 | if( chmod( file.latin1(), moder) < 0) { | 264 | if( chmod( file.latin1(), moder) < 0) { |
269 | perror("chmod"); | 265 | perror("chmod"); |
270 | QMessageBox::warning(this,tr("Warning"),tr("Error setting mode")); | 266 | QMessageBox::warning(this,tr("Warning"),tr("Error setting mode")); |
271 | return; | 267 | return; |
272 | } | 268 | } |
273 | } | 269 | } |
274 | } | 270 | } |
275 | close(); | 271 | close(); |
276 | } | 272 | } |
diff --git a/noncore/net/opieftp/inputDialog.cpp b/noncore/net/opieftp/inputDialog.cpp index 373db3b..23741c0 100644 --- a/noncore/net/opieftp/inputDialog.cpp +++ b/noncore/net/opieftp/inputDialog.cpp | |||
@@ -1,44 +1,40 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | inputDialog.cpp | 2 | inputDialog.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 | 12 | ||
13 | #include "inputDialog.h" | 13 | #include "inputDialog.h" |
14 | 14 | ||
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlayout.h> | ||
17 | #include <qvariant.h> | ||
18 | #include <qtooltip.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | 16 | ||
21 | 17 | ||
22 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 18 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
23 | : QDialog( parent, name, modal, fl ) | 19 | : QDialog( parent, name, modal, fl ) |
24 | { | 20 | { |
25 | if ( !name ) | 21 | if ( !name ) |
26 | setName( "InputDialog" ); | 22 | setName( "InputDialog" ); |
27 | resize( 234, 50 ); | 23 | resize( 234, 50 ); |
28 | setMaximumSize( QSize( 240, 50 ) ); | 24 | setMaximumSize( QSize( 240, 50 ) ); |
29 | setCaption( tr(name ) ); | 25 | setCaption( tr(name ) ); |
30 | 26 | ||
31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 27 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
32 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 28 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
33 | } | 29 | } |
34 | 30 | ||
35 | InputDialog::~InputDialog() | 31 | InputDialog::~InputDialog() |
36 | { | 32 | { |
37 | inputText= LineEdit1->text(); | 33 | inputText= LineEdit1->text(); |
38 | 34 | ||
39 | } | 35 | } |
40 | 36 | ||
41 | void InputDialog::setTextEdit(const QString &string) | 37 | void InputDialog::setTextEdit(const QString &string) |
42 | { | 38 | { |
43 | LineEdit1->setText(string); | 39 | LineEdit1->setText(string); |
44 | } | 40 | } |
diff --git a/noncore/net/opieftp/main.cpp b/noncore/net/opieftp/main.cpp index 28676e1..4f5a7d4 100644 --- a/noncore/net/opieftp/main.cpp +++ b/noncore/net/opieftp/main.cpp | |||
@@ -1,31 +1,27 @@ | |||
1 | 1 | ||
2 | /*************************************************************************** | 2 | /*************************************************************************** |
3 | main.cpp - description | 3 | main.cpp - description |
4 | ------------------- | 4 | ------------------- |
5 | begin : March 10, 2002 | 5 | begin : March 10, 2002 |
6 | copyright : (C) 2002 by llornkcor | 6 | copyright : (C) 2002 by llornkcor |
7 | email : ljp@llornkcor.com | 7 | email : ljp@llornkcor.com |
8 | * This program is free software; you can redistribute it and/or modify * | 8 | * This program is free software; you can redistribute it and/or modify * |
9 | * it under the terms of the GNU General Public License as published by * | 9 | * it under the terms of the GNU General Public License as published by * |
10 | * the Free Software Foundation; either version 2 of the License, or * | 10 | * the Free Software Foundation; either version 2 of the License, or * |
11 | * (at your option) any later version. * | 11 | * (at your option) any later version. * |
12 | ***************************************************************************/ | 12 | ***************************************************************************/ |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/qcopenvelope_qws.h> | ||
15 | #include <qpe/config.h> | ||
16 | #include <qstring.h> | ||
17 | #include <qstringlist.h> | ||
18 | 14 | ||
19 | 15 | ||
20 | 16 | ||
21 | #include "opieftp.h" | 17 | #include "opieftp.h" |
22 | 18 | ||
23 | int main(int argc, char *argv[]) | 19 | int main(int argc, char *argv[]) |
24 | { | 20 | { |
25 | QPEApplication a(argc, argv); | 21 | QPEApplication a(argc, argv); |
26 | 22 | ||
27 | OpieFtp opieftp; | 23 | OpieFtp opieftp; |
28 | a.showMainWidget( &opieftp); | 24 | a.showMainWidget( &opieftp); |
29 | return a.exec(); | 25 | return a.exec(); |
30 | } | 26 | } |
31 | 27 | ||
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e81b7ca..668a03d 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,437 +1,423 @@ | |||
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 | ||
16 | extern "C" { | 16 | extern "C" { |
17 | #include "../ftplib/ftplib.h" | 17 | #include "../ftplib/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> | ||
24 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
26 | #include <qpe/qcopenvelope_qws.h> | ||
27 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
28 | #include <qpe/mimetype.h> | 26 | #include <qpe/mimetype.h> |
29 | #include <qpe/qpemessagebox.h> | ||
30 | 27 | ||
31 | #include <qstringlist.h> | ||
32 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
33 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
34 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
35 | #include <qdatetime.h> | ||
36 | #include <qdir.h> | ||
37 | #include <qfile.h> | ||
38 | #include <qstring.h> | ||
39 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
40 | #include <qpopupmenu.h> | ||
41 | #include <qlistview.h> | 32 | #include <qlistview.h> |
42 | #include <qmainwindow.h> | ||
43 | #include <qlabel.h> | 33 | #include <qlabel.h> |
44 | #include <qprogressbar.h> | 34 | #include <qprogressbar.h> |
45 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
46 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
47 | #include <qwidget.h> | ||
48 | #include <qlayout.h> | 37 | #include <qlayout.h> |
49 | #include <qimage.h> | ||
50 | #include <qpixmap.h> | ||
51 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
52 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
53 | #include <qregexp.h> | ||
54 | #include <qlistbox.h> | 40 | #include <qlistbox.h> |
55 | 41 | ||
56 | #include <unistd.h> | 42 | #include <unistd.h> |
57 | #include <stdlib.h> | 43 | #include <stdlib.h> |
58 | 44 | ||
59 | 45 | ||
60 | QProgressBar *ProgressBar; | 46 | QProgressBar *ProgressBar; |
61 | static netbuf *conn=NULL; | 47 | static netbuf *conn=NULL; |
62 | 48 | ||
63 | static int log_progress(netbuf *, int xfered, void *) | 49 | static int log_progress(netbuf *, int xfered, void *) |
64 | { | 50 | { |
65 | // int fsz = *(int *)arg; | 51 | // int fsz = *(int *)arg; |
66 | // int pct = (xfered * 100) / fsz; | 52 | // int pct = (xfered * 100) / fsz; |
67 | // printf("%3d%%\r", pct); | 53 | // printf("%3d%%\r", pct); |
68 | // fflush(stdout); | 54 | // fflush(stdout); |
69 | ProgressBar->setProgress(xfered); | 55 | ProgressBar->setProgress(xfered); |
70 | qApp->processEvents(); | 56 | qApp->processEvents(); |
71 | return 1; | 57 | return 1; |
72 | } | 58 | } |
73 | 59 | ||
74 | OpieFtp::OpieFtp( ) | 60 | OpieFtp::OpieFtp( ) |
75 | : QMainWindow( ) | 61 | : QMainWindow( ) |
76 | { | 62 | { |
77 | setCaption( tr( "OpieFtp" ) ); | 63 | setCaption( tr( "OpieFtp" ) ); |
78 | fuckeduphack=FALSE; | 64 | fuckeduphack=FALSE; |
79 | QGridLayout *layout = new QGridLayout( this ); | 65 | QGridLayout *layout = new QGridLayout( this ); |
80 | layout->setSpacing( 2); | 66 | layout->setSpacing( 2); |
81 | layout->setMargin( 2); | 67 | layout->setMargin( 2); |
82 | 68 | ||
83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 69 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
84 | 70 | ||
85 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 71 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
86 | // QPEToolBar *menuBar = new QPEToolBar(this); | 72 | // QPEToolBar *menuBar = new QPEToolBar(this); |
87 | // menuBar->setHorizontalStretchable( TRUE ); | 73 | // menuBar->setHorizontalStretchable( TRUE ); |
88 | 74 | ||
89 | QWMatrix matrix; | 75 | QWMatrix matrix; |
90 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); | 76 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); |
91 | matrix.scale( .4, .4); | 77 | matrix.scale( .4, .4); |
92 | unknownXpm = pix.xForm(matrix); | 78 | unknownXpm = pix.xForm(matrix); |
93 | 79 | ||
94 | connectionMenu = new QPopupMenu( this ); | 80 | connectionMenu = new QPopupMenu( this ); |
95 | localMenu = new QPopupMenu( this ); | 81 | localMenu = new QPopupMenu( this ); |
96 | remoteMenu = new QPopupMenu( this ); | 82 | remoteMenu = new QPopupMenu( this ); |
97 | tabMenu = new QPopupMenu( this ); | 83 | tabMenu = new QPopupMenu( this ); |
98 | 84 | ||
99 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 85 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
100 | 86 | ||
101 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 87 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
102 | // menuBar->insertItem( tr( "Local" ), localMenu); | 88 | // menuBar->insertItem( tr( "Local" ), localMenu); |
103 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); | 89 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); |
104 | menuBar->insertItem( tr( "View" ), tabMenu); | 90 | menuBar->insertItem( tr( "View" ), tabMenu); |
105 | 91 | ||
106 | tabMenu->insertItem( tr( "Local" ), localMenu); | 92 | tabMenu->insertItem( tr( "Local" ), localMenu); |
107 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); | 93 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); |
108 | 94 | ||
109 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 95 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
110 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 96 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
111 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 97 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
112 | 98 | ||
113 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 99 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
114 | localMenu->insertSeparator(); | 100 | localMenu->insertSeparator(); |
115 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 101 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
116 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 102 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
117 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 103 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
118 | localMenu->insertSeparator(); | 104 | localMenu->insertSeparator(); |
119 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 105 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
120 | localMenu->setCheckable(TRUE); | 106 | localMenu->setCheckable(TRUE); |
121 | 107 | ||
122 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 108 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
123 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 109 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
124 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 110 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
125 | remoteMenu->insertSeparator(); | 111 | remoteMenu->insertSeparator(); |
126 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 112 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
127 | 113 | ||
128 | tabMenu->insertSeparator(); | 114 | tabMenu->insertSeparator(); |
129 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 115 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
130 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 116 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
131 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 117 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
132 | tabMenu->insertSeparator(); | 118 | tabMenu->insertSeparator(); |
133 | // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 119 | // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
134 | tabMenu->setCheckable(TRUE); | 120 | tabMenu->setCheckable(TRUE); |
135 | 121 | ||
136 | 122 | ||
137 | 123 | ||
138 | cdUpButton = new QToolButton( this,"cdUpButton"); | 124 | cdUpButton = new QToolButton( this,"cdUpButton"); |
139 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 125 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
140 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 126 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
141 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 127 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
142 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 128 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
143 | cdUpButton->hide(); | 129 | cdUpButton->hide(); |
144 | 130 | ||
145 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 131 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
146 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 132 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
147 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 133 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
148 | // docButton->setFlat(TRUE); | 134 | // docButton->setFlat(TRUE); |
149 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 135 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
150 | 136 | ||
151 | homeButton = new QToolButton(this,"homeButton"); | 137 | homeButton = new QToolButton(this,"homeButton"); |
152 | homeButton->setPixmap( Resource::loadPixmap("home")); | 138 | homeButton->setPixmap( Resource::loadPixmap("home")); |
153 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 139 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
154 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 140 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
155 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 141 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
156 | homeButton->hide(); | 142 | homeButton->hide(); |
157 | 143 | ||
158 | TabWidget = new QTabWidget( this, "TabWidget" ); | 144 | TabWidget = new QTabWidget( this, "TabWidget" ); |
159 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 145 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
160 | 146 | ||
161 | // TabWidget->setTabShape(QTabWidget::Triangular); | 147 | // TabWidget->setTabShape(QTabWidget::Triangular); |
162 | 148 | ||
163 | tab = new QWidget( TabWidget, "tab" ); | 149 | tab = new QWidget( TabWidget, "tab" ); |
164 | tabLayout = new QGridLayout( tab ); | 150 | tabLayout = new QGridLayout( tab ); |
165 | tabLayout->setSpacing( 2); | 151 | tabLayout->setSpacing( 2); |
166 | tabLayout->setMargin( 2); | 152 | tabLayout->setMargin( 2); |
167 | 153 | ||
168 | Local_View = new QListView( tab, "Local_View" ); | 154 | Local_View = new QListView( tab, "Local_View" ); |
169 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 155 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
170 | Local_View->addColumn( tr("File"),150); | 156 | Local_View->addColumn( tr("File"),150); |
171 | Local_View->addColumn( tr("Date"),-1); | 157 | Local_View->addColumn( tr("Date"),-1); |
172 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 158 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
173 | Local_View->addColumn( tr("Size"),-1); | 159 | Local_View->addColumn( tr("Size"),-1); |
174 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 160 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
175 | Local_View->setAllColumnsShowFocus(TRUE); | 161 | Local_View->setAllColumnsShowFocus(TRUE); |
176 | 162 | ||
177 | Local_View->setMultiSelection( TRUE); | 163 | Local_View->setMultiSelection( TRUE); |
178 | Local_View->setSelectionMode(QListView::Extended); | 164 | Local_View->setSelectionMode(QListView::Extended); |
179 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 165 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
180 | 166 | ||
181 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 167 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
182 | 168 | ||
183 | tabLayout->addWidget( Local_View, 0, 0 ); | 169 | tabLayout->addWidget( Local_View, 0, 0 ); |
184 | 170 | ||
185 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 171 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
186 | this,SLOT( localListClicked(QListViewItem *)) ); | 172 | this,SLOT( localListClicked(QListViewItem *)) ); |
187 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 173 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
188 | // this,SLOT( localListClicked(QListViewItem *)) ); | 174 | // this,SLOT( localListClicked(QListViewItem *)) ); |
189 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 175 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
190 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 176 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
191 | 177 | ||
192 | TabWidget->insertTab( tab, tr( "Local" ) ); | 178 | TabWidget->insertTab( tab, tr( "Local" ) ); |
193 | 179 | ||
194 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 180 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
195 | tabLayout_2 = new QGridLayout( tab_2 ); | 181 | tabLayout_2 = new QGridLayout( tab_2 ); |
196 | tabLayout_2->setSpacing( 2); | 182 | tabLayout_2->setSpacing( 2); |
197 | tabLayout_2->setMargin( 2); | 183 | tabLayout_2->setMargin( 2); |
198 | 184 | ||
199 | Remote_View = new QListView( tab_2, "Remote_View" ); | 185 | Remote_View = new QListView( tab_2, "Remote_View" ); |
200 | Remote_View->addColumn( tr("File"),150); | 186 | Remote_View->addColumn( tr("File"),150); |
201 | Remote_View->addColumn( tr("Date"),-1); | 187 | Remote_View->addColumn( tr("Date"),-1); |
202 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); | 188 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
203 | Remote_View->addColumn( tr("Size"),-1); | 189 | Remote_View->addColumn( tr("Size"),-1); |
204 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 190 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
205 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | 191 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); |
206 | Remote_View->addColumn( tr("Dir"),-1); | 192 | Remote_View->addColumn( tr("Dir"),-1); |
207 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 193 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
208 | Remote_View->setAllColumnsShowFocus(TRUE); | 194 | Remote_View->setAllColumnsShowFocus(TRUE); |
209 | 195 | ||
210 | Remote_View->setMultiSelection( FALSE); | 196 | Remote_View->setMultiSelection( FALSE); |
211 | Remote_View->setSelectionMode(QListView::Extended); | 197 | Remote_View->setSelectionMode(QListView::Extended); |
212 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 198 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
213 | 199 | ||
214 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 200 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
215 | 201 | ||
216 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 202 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
217 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 203 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
218 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 204 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
219 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 205 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
220 | 206 | ||
221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 207 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
222 | 208 | ||
223 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 209 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
224 | 210 | ||
225 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 211 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
226 | tabLayout_3 = new QGridLayout( tab_3 ); | 212 | tabLayout_3 = new QGridLayout( tab_3 ); |
227 | tabLayout_3->setSpacing( 2); | 213 | tabLayout_3->setSpacing( 2); |
228 | tabLayout_3->setMargin( 2); | 214 | tabLayout_3->setMargin( 2); |
229 | 215 | ||
230 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 216 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
231 | TextLabel1->setText( tr( "Username" ) ); | 217 | TextLabel1->setText( tr( "Username" ) ); |
232 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 218 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
233 | 219 | ||
234 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 220 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
235 | UsernameComboBox->setEditable(TRUE); | 221 | UsernameComboBox->setEditable(TRUE); |
236 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 222 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
237 | 223 | ||
238 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, | 224 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, |
239 | SLOT( UsernameComboBoxEdited(const QString & ) )); | 225 | SLOT( UsernameComboBoxEdited(const QString & ) )); |
240 | 226 | ||
241 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 227 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
242 | TextLabel2->setText( tr( "Password" ) ); | 228 | TextLabel2->setText( tr( "Password" ) ); |
243 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 229 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
244 | 230 | ||
245 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 231 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
246 | PasswordEdit->setEchoMode(QLineEdit::Password); | 232 | PasswordEdit->setEchoMode(QLineEdit::Password); |
247 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 233 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
248 | 234 | ||
249 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, | 235 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, |
250 | SLOT( PasswordEditEdited(const QString & ) )); | 236 | SLOT( PasswordEditEdited(const QString & ) )); |
251 | 237 | ||
252 | //PasswordEdit->setFixedWidth(85); | 238 | //PasswordEdit->setFixedWidth(85); |
253 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 239 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
254 | TextLabel3->setText( tr( "Remote server" ) ); | 240 | TextLabel3->setText( tr( "Remote server" ) ); |
255 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 241 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
256 | 242 | ||
257 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 243 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
258 | ServerComboBox->setEditable(TRUE); | 244 | ServerComboBox->setEditable(TRUE); |
259 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 245 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
260 | 246 | ||
261 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 247 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
262 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, | 248 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, |
263 | SLOT(serverComboEdited(const QString & ) )); | 249 | SLOT(serverComboEdited(const QString & ) )); |
264 | 250 | ||
265 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 251 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
266 | TextLabel5->setText( tr( "Remote path" ) ); | 252 | TextLabel5->setText( tr( "Remote path" ) ); |
267 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 253 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
268 | 254 | ||
269 | 255 | ||
270 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 256 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
271 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 257 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
272 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 258 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
273 | TextLabel4->setText( tr( "Port" ) ); | 259 | TextLabel4->setText( tr( "Port" ) ); |
274 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 260 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
275 | 261 | ||
276 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 262 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
277 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 263 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
278 | PortSpinBox->setMaxValue(32786); | 264 | PortSpinBox->setMaxValue(32786); |
279 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 265 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
280 | 266 | ||
281 | serverListView = new QListBox( tab_3, "ServerListView" ); | 267 | serverListView = new QListBox( tab_3, "ServerListView" ); |
282 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 268 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
283 | 269 | ||
284 | connect( serverListView, SIGNAL( highlighted( const QString &)), | 270 | connect( serverListView, SIGNAL( highlighted( const QString &)), |
285 | this,SLOT( serverListClicked( const QString &) ) ); | 271 | this,SLOT( serverListClicked( const QString &) ) ); |
286 | 272 | ||
287 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 273 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
288 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 274 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
289 | connectServerBtn->setToggleButton(TRUE); | 275 | connectServerBtn->setToggleButton(TRUE); |
290 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 276 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
291 | 277 | ||
292 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); | 278 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); |
293 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 279 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
294 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 280 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
295 | 281 | ||
296 | QPushButton *deleteServerBtn; | 282 | QPushButton *deleteServerBtn; |
297 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); | 283 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); |
298 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 284 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
299 | 285 | ||
300 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 286 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
301 | 287 | ||
302 | 288 | ||
303 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 289 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
304 | tabLayout_3->addItem( spacer, 5, 0 ); | 290 | tabLayout_3->addItem( spacer, 5, 0 ); |
305 | 291 | ||
306 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 292 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
307 | 293 | ||
308 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 294 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
309 | this,SLOT(tabChanged(QWidget*))); | 295 | this,SLOT(tabChanged(QWidget*))); |
310 | 296 | ||
311 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 297 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
312 | currentDir.setPath( QDir::currentDirPath()); | 298 | currentDir.setPath( QDir::currentDirPath()); |
313 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 299 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
314 | 300 | ||
315 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 301 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
316 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 302 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
317 | currentPathCombo ->setFixedWidth(220); | 303 | currentPathCombo ->setFixedWidth(220); |
318 | currentPathCombo->setEditable(TRUE); | 304 | currentPathCombo->setEditable(TRUE); |
319 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 305 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
320 | 306 | ||
321 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 307 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
322 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 308 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
323 | 309 | ||
324 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 310 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
325 | this,SLOT(currentPathComboChanged())); | 311 | this,SLOT(currentPathComboChanged())); |
326 | 312 | ||
327 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 313 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
328 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 314 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
329 | ProgressBar->setMaximumHeight(10); | 315 | ProgressBar->setMaximumHeight(10); |
330 | filterStr="*"; | 316 | filterStr="*"; |
331 | b=FALSE; | 317 | b=FALSE; |
332 | populateLocalView(); | 318 | populateLocalView(); |
333 | readConfig(); | 319 | readConfig(); |
334 | 320 | ||
335 | // ServerComboBox->setCurrentItem(currentServerConfig); | 321 | // ServerComboBox->setCurrentItem(currentServerConfig); |
336 | 322 | ||
337 | TabWidget->setCurrentPage(2); | 323 | TabWidget->setCurrentPage(2); |
338 | } | 324 | } |
339 | 325 | ||
340 | OpieFtp::~OpieFtp() | 326 | OpieFtp::~OpieFtp() |
341 | { | 327 | { |
342 | } | 328 | } |
343 | 329 | ||
344 | void OpieFtp::cleanUp() | 330 | void OpieFtp::cleanUp() |
345 | { | 331 | { |
346 | if(conn) | 332 | if(conn) |
347 | FtpQuit(conn); | 333 | FtpQuit(conn); |
348 | QString sfile=QDir::homeDirPath(); | 334 | QString sfile=QDir::homeDirPath(); |
349 | if(sfile.right(1) != "/") | 335 | if(sfile.right(1) != "/") |
350 | sfile+="/._temp"; | 336 | sfile+="/._temp"; |
351 | else | 337 | else |
352 | sfile+="._temp"; | 338 | sfile+="._temp"; |
353 | QFile file( sfile); | 339 | QFile file( sfile); |
354 | if(file.exists()) | 340 | if(file.exists()) |
355 | file.remove(); | 341 | file.remove(); |
356 | Config cfg("opieftp"); | 342 | Config cfg("opieftp"); |
357 | cfg.setGroup("Server"); | 343 | cfg.setGroup("Server"); |
358 | cfg.writeEntry("currentServer", currentServerConfig); | 344 | cfg.writeEntry("currentServer", currentServerConfig); |
359 | 345 | ||
360 | exit(0); | 346 | exit(0); |
361 | } | 347 | } |
362 | 348 | ||
363 | void OpieFtp::tabChanged(QWidget *) | 349 | void OpieFtp::tabChanged(QWidget *) |
364 | { | 350 | { |
365 | if (TabWidget->currentPageIndex() == 0) { | 351 | if (TabWidget->currentPageIndex() == 0) { |
366 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 352 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
367 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 353 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
368 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 354 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
369 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 355 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
370 | if(cdUpButton->isHidden()) | 356 | if(cdUpButton->isHidden()) |
371 | cdUpButton->show(); | 357 | cdUpButton->show(); |
372 | if(homeButton->isHidden()) | 358 | if(homeButton->isHidden()) |
373 | homeButton->show(); | 359 | homeButton->show(); |
374 | 360 | ||
375 | } | 361 | } |
376 | if (TabWidget->currentPageIndex() == 1) { | 362 | if (TabWidget->currentPageIndex() == 1) { |
377 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 363 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
378 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 364 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
379 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 365 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
380 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 366 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
381 | if(cdUpButton->isHidden()) | 367 | if(cdUpButton->isHidden()) |
382 | cdUpButton->show(); | 368 | cdUpButton->show(); |
383 | homeButton->hide(); | 369 | homeButton->hide(); |
384 | 370 | ||
385 | } | 371 | } |
386 | if (TabWidget->currentPageIndex() == 2) { | 372 | if (TabWidget->currentPageIndex() == 2) { |
387 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 373 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
388 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 374 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
389 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 375 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
390 | cdUpButton->hide(); | 376 | cdUpButton->hide(); |
391 | homeButton->hide(); | 377 | homeButton->hide(); |
392 | } | 378 | } |
393 | } | 379 | } |
394 | 380 | ||
395 | void OpieFtp::newConnection() | 381 | void OpieFtp::newConnection() |
396 | { | 382 | { |
397 | UsernameComboBox->lineEdit()->setText(""); | 383 | UsernameComboBox->lineEdit()->setText(""); |
398 | PasswordEdit->setText( "" ); | 384 | PasswordEdit->setText( "" ); |
399 | ServerComboBox->lineEdit()->setText( ""); | 385 | ServerComboBox->lineEdit()->setText( ""); |
400 | remotePath->setText( currentRemoteDir = "/"); | 386 | remotePath->setText( currentRemoteDir = "/"); |
401 | PortSpinBox->setValue( 21); | 387 | PortSpinBox->setValue( 21); |
402 | TabWidget->setCurrentPage(2); | 388 | TabWidget->setCurrentPage(2); |
403 | } | 389 | } |
404 | 390 | ||
405 | void OpieFtp::serverComboEdited(const QString & ) | 391 | void OpieFtp::serverComboEdited(const QString & ) |
406 | { | 392 | { |
407 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 393 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
408 | // qDebug("ServerComboEdited"); | 394 | // qDebug("ServerComboEdited"); |
409 | // // currentServerConfig = -1; | 395 | // // currentServerConfig = -1; |
410 | // } | 396 | // } |
411 | } | 397 | } |
412 | 398 | ||
413 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 399 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
414 | // currentServerConfig = -1; | 400 | // currentServerConfig = -1; |
415 | } | 401 | } |
416 | 402 | ||
417 | void OpieFtp::PasswordEditEdited(const QString & ) { | 403 | void OpieFtp::PasswordEditEdited(const QString & ) { |
418 | // currentServerConfig = -1; | 404 | // currentServerConfig = -1; |
419 | } | 405 | } |
420 | 406 | ||
421 | void OpieFtp::connectorBtnToggled(bool On) | 407 | void OpieFtp::connectorBtnToggled(bool On) |
422 | { | 408 | { |
423 | if(On) { | 409 | if(On) { |
424 | connector(); | 410 | connector(); |
425 | } else { | 411 | } else { |
426 | disConnector(); | 412 | disConnector(); |
427 | } | 413 | } |
428 | 414 | ||
429 | } | 415 | } |
430 | 416 | ||
431 | void OpieFtp::connector() | 417 | void OpieFtp::connector() |
432 | { | 418 | { |
433 | // QCopEnvelope ( "QPE/System", "busy()" ); | 419 | // QCopEnvelope ( "QPE/System", "busy()" ); |
434 | // qApp->processEvents(); | 420 | // qApp->processEvents(); |
435 | currentRemoteDir=remotePath->text(); | 421 | currentRemoteDir=remotePath->text(); |
436 | 422 | ||
437 | if( ServerComboBox->currentText().isEmpty()) { | 423 | if( ServerComboBox->currentText().isEmpty()) { |