summaryrefslogtreecommitdiffabout
path: root/microkde/kio/kfile
Side-by-side diff
Diffstat (limited to 'microkde/kio/kfile') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp7
-rw-r--r--microkde/kio/kfile/kurlrequester.h2
2 files changed, 7 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
@@ -202,25 +202,25 @@ KURLRequester::KURLRequester( const QString& url, QWidget *parent,
KURLRequester::~KURLRequester()
{
//US delete myCompletion;
delete myFileDialog;
delete d;
}
void KURLRequester::init()
{
myFileDialog = 0L;
myShowLocalProt = false;
-
+ mPathIsDir = false;
if (/*US !d->combo && */ !d->edit )
d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
myButton = new KURLDragPushButton( this, "kfile button");
QIconSet iconSet = SmallIconSet("fileopen");
QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
myButton->setIconSet( iconSet );
myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
//US QToolTip::add(myButton, i18n("Open file dialog"));
connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
@@ -263,25 +263,28 @@ QString KURLRequester::url() const
return d->url();
}
void KURLRequester::slotOpenDialog()
{
emit openFileDialog( this );
//US use our special KFIleDialog instead
KURL u( url() );
//QString fn = u.url();
QString fn = d->edit->text();
- fn = KFileDialog::getSaveFileName( fn, "", this );
+ if ( mPathIsDir )
+ fn = KFileDialog::getExistingDirectory ( fn, "", this );
+ else
+ fn = KFileDialog::getSaveFileName( fn, "", this );
if ( fn == "" )
return;
setURL( fn );
emit urlSelected( d->url() );
/*US
KFileDialog *dlg = fileDialog();
if ( !d->url().isEmpty() ) {
KURL u( url() );
// If we won't be able to list it (e.g. http), then don't try :)
if ( KProtocolInfo::supportsListing( u.protocol() ) )
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h
index 3253dd5..faa3326 100644
--- a/microkde/kio/kfile/kurlrequester.h
+++ b/microkde/kio/kfile/kurlrequester.h
@@ -96,24 +96,25 @@ public:
* Default is false, not showing file:/
* @see #showLocalProtocol
*/
void setShowLocalProtocol( bool b );
/**
* Sets the mode of the file dialog.
* Note: you can only select one file with the filedialog,
* so KFile::Files doesn't make much sense.
* @see KFileDialog::setMode()
*/
void setMode( unsigned int m );
+ void setPathIsDir( ) {mPathIsDir = true;}
/**
* Sets the filter for the file dialog.
* @see KFileDialog::setFilter()
*/
void setFilter( const QString& filter );
/**
* @returns whether local files will be prefixed with file:/ in the
* lineedit
* @see #setShowLocalProtocol
*/
@@ -225,24 +226,25 @@ signals:
void urlSelected( const QString& );
protected:
void init();
//US KURLCompletion * myCompletion;
private:
KURLDragPushButton * myButton;
bool myShowLocalProt;
mutable KFileDialog * myFileDialog;
+ bool mPathIsDir;
protected slots:
/**
* Called when the button is pressed to open the filedialog.
* Also called when @ref KStdAccel::Open (default is Ctrl-O) is pressed.
*/
void slotOpenDialog();
private slots:
void slotUpdateURL();