summaryrefslogtreecommitdiffabout
path: root/microkde/kio/kfile/kurlrequester.cpp
Unidiff
Diffstat (limited to 'microkde/kio/kfile/kurlrequester.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index 991c8be..ca94570 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -190,49 +190,49 @@ KURLRequester::KURLRequester( QWidget *parent, const char *name )
190 190
191 191
192KURLRequester::KURLRequester( const QString& url, QWidget *parent, 192KURLRequester::KURLRequester( const QString& url, QWidget *parent,
193 const char *name ) 193 const char *name )
194 : QHBox( parent, name ) 194 : QHBox( parent, name )
195{ 195{
196 d = new KURLRequesterPrivate; 196 d = new KURLRequesterPrivate;
197 init(); 197 init();
198 setURL( url ); 198 setURL( url );
199} 199}
200 200
201 201
202KURLRequester::~KURLRequester() 202KURLRequester::~KURLRequester()
203{ 203{
204//US delete myCompletion; 204//US delete myCompletion;
205 delete myFileDialog; 205 delete myFileDialog;
206 delete d; 206 delete d;
207} 207}
208 208
209 209
210void KURLRequester::init() 210void KURLRequester::init()
211{ 211{
212 myFileDialog = 0L; 212 myFileDialog = 0L;
213 myShowLocalProt = false; 213 myShowLocalProt = false;
214 214 mPathIsDir = false;
215 if (/*US !d->combo && */ !d->edit ) 215 if (/*US !d->combo && */ !d->edit )
216 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); 216 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
217 217
218 myButton = new KURLDragPushButton( this, "kfile button"); 218 myButton = new KURLDragPushButton( this, "kfile button");
219 QIconSet iconSet = SmallIconSet("fileopen"); 219 QIconSet iconSet = SmallIconSet("fileopen");
220 QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); 220 QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
221 myButton->setIconSet( iconSet ); 221 myButton->setIconSet( iconSet );
222 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); 222 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
223//US QToolTip::add(myButton, i18n("Open file dialog")); 223//US QToolTip::add(myButton, i18n("Open file dialog"));
224 224
225 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); 225 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
226 226
227 setSpacing( KDialog::spacingHint() ); 227 setSpacing( KDialog::spacingHint() );
228 228
229 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; 229 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit;
230 setFocusProxy( widget ); 230 setFocusProxy( widget );
231 231
232 d->connectSignals( this ); 232 d->connectSignals( this );
233 connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() )); 233 connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() ));
234/*US 234/*US
235 myCompletion = new KURLCompletion(); 235 myCompletion = new KURLCompletion();
236 d->setCompletionObject( myCompletion ); 236 d->setCompletionObject( myCompletion );
237 237
238 KAccel *accel = new KAccel( this ); 238 KAccel *accel = new KAccel( this );
@@ -251,49 +251,52 @@ void KURLRequester::setURL( const QString& url )
251 else 251 else
252 d->setText( url ); 252 d->setText( url );
253} 253}
254 254
255void KURLRequester::setCaption( const QString& caption ) 255void KURLRequester::setCaption( const QString& caption )
256{ 256{
257 //USfileDialog()->setCaption( caption ); 257 //USfileDialog()->setCaption( caption );
258 //USQWidget::setCaption( caption ); 258 //USQWidget::setCaption( caption );
259} 259}
260 260
261QString KURLRequester::url() const 261QString KURLRequester::url() const
262{ 262{
263 return d->url(); 263 return d->url();
264} 264}
265 265
266 266
267void KURLRequester::slotOpenDialog() 267void KURLRequester::slotOpenDialog()
268{ 268{
269 emit openFileDialog( this ); 269 emit openFileDialog( this );
270 270
271//US use our special KFIleDialog instead 271//US use our special KFIleDialog instead
272 KURL u( url() ); 272 KURL u( url() );
273 //QString fn = u.url(); 273 //QString fn = u.url();
274 QString fn = d->edit->text(); 274 QString fn = d->edit->text();
275 fn = KFileDialog::getSaveFileName( fn, "", this ); 275 if ( mPathIsDir )
276 fn = KFileDialog::getExistingDirectory ( fn, "", this );
277 else
278 fn = KFileDialog::getSaveFileName( fn, "", this );
276 279
277 if ( fn == "" ) 280 if ( fn == "" )
278 return; 281 return;
279 282
280 setURL( fn ); 283 setURL( fn );
281 emit urlSelected( d->url() ); 284 emit urlSelected( d->url() );
282/*US 285/*US
283 KFileDialog *dlg = fileDialog(); 286 KFileDialog *dlg = fileDialog();
284 if ( !d->url().isEmpty() ) { 287 if ( !d->url().isEmpty() ) {
285 KURL u( url() ); 288 KURL u( url() );
286 // If we won't be able to list it (e.g. http), then don't try :) 289 // If we won't be able to list it (e.g. http), then don't try :)
287 if ( KProtocolInfo::supportsListing( u.protocol() ) ) 290 if ( KProtocolInfo::supportsListing( u.protocol() ) )
288 dlg->setSelection( u.url() ); 291 dlg->setSelection( u.url() );
289 } 292 }
290 293
291 if ( dlg->exec() == QDialog::Accepted ) 294 if ( dlg->exec() == QDialog::Accepted )
292 { 295 {
293 setURL( dlg->selectedURL().prettyURL() ); 296 setURL( dlg->selectedURL().prettyURL() );
294 emit urlSelected( d->url() ); 297 emit urlSelected( d->url() );
295 } 298 }
296*/ 299*/
297 300
298} 301}
299 302