author | zautrix <zautrix> | 2005-06-11 17:03:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-11 17:03:59 (UTC) |
commit | 81370a5f955c2710b6e9336b6c412c8d630ef72a (patch) (side-by-side diff) | |
tree | 6252851fbafcbc3ff777e1af0171990124beb23e /microkde | |
parent | 0cfaf22fc5d8f511320813171be84ce3436990c6 (diff) | |
download | kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.zip kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.gz kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.bz2 |
fixes
-rw-r--r-- | microkde/kfiledialog.cpp | 11 | ||||
-rw-r--r-- | microkde/kfiledialog.h | 2 | ||||
-rw-r--r-- | microkde/kio/kfile/kurlrequester.cpp | 7 | ||||
-rw-r--r-- | microkde/kio/kfile/kurlrequester.h | 2 |
4 files changed, 19 insertions, 3 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 6be1580..c64f325 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp @@ -46,34 +46,43 @@ QString KFileDialog::getOpenFileName( const QString & fn, lay.setMargin(7); lay.setSpacing(7); QString file = fn; if ( file.isEmpty() ) file = QDir::homeDirPath()+"/*";; QFileInfo fi ( file ); OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); lay.addWidget( &o); dia.showMaximized(); dia.setCaption( cap ); int res = dia.exec(); if ( res ) retfile = o.selectedName(); return retfile; } - +QString KFileDialog::getExistingDirectory( const QString & fn, + const QString & cap, QWidget * par ) +{ + return KFileDialog::getSaveFileName( fn, cap, pr ); +} #else #include <qfiledialog.h> QString KFileDialog::getSaveFileName( const QString & fn, const QString & cap , QWidget * par ) { return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); } QString KFileDialog::getOpenFileName( const QString & fn, const QString & cap, QWidget * par ) { return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); } +QString KFileDialog::getExistingDirectory( const QString & fn, + const QString & cap, QWidget * par ) +{ + return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); +} #endif diff --git a/microkde/kfiledialog.h b/microkde/kfiledialog.h index 0825872..90709cd 100644 --- a/microkde/kfiledialog.h +++ b/microkde/kfiledialog.h @@ -2,19 +2,21 @@ #define MICROKDE_KFILEDIALOG_H #include <qstring.h> #include <qwidget.h> class KFileDialog { public: static QString getSaveFileName( const QString &, const QString &, QWidget * ); static QString getOpenFileName( const QString &, const QString &, QWidget * ); + static QString getExistingDirectory( const QString &, + const QString &, QWidget * ); }; #endif 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 @@ -198,33 +198,33 @@ KURLRequester::KURLRequester( const QString& url, QWidget *parent, setURL( url ); } 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() )); setSpacing( KDialog::spacingHint() ); QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; setFocusProxy( widget ); @@ -259,33 +259,36 @@ void KURLRequester::setCaption( const QString& caption ) } 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() ) ) dlg->setSelection( u.url() ); } if ( dlg->exec() == QDialog::Accepted ) 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 @@ -92,32 +92,33 @@ public: /** * Enables/disables showing file:/ in the lineedit, when a local file has * been selected in the filedialog or was set via @ref setURL(). * 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 */ bool showLocalProtocol() const { return myShowLocalProt; } /** * @returns a pointer to the filedialog @@ -221,32 +222,33 @@ signals: /** * Emitted when the user changed the URL via the file dialog. * The parameter contains the contents of the lineedit. */ 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(); protected: virtual void virtual_hook( int id, void* data ); private: class KURLRequesterPrivate; |