summaryrefslogtreecommitdiffabout
path: root/microkde/kio/kfile
Unidiff
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,
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
@@ -263,25 +263,28 @@ QString KURLRequester::url() const
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() ) )
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:
96 * Default is false, not showing file:/ 96 * Default is false, not showing file:/
97 * @see #showLocalProtocol 97 * @see #showLocalProtocol
98 */ 98 */
99 void setShowLocalProtocol( bool b ); 99 void setShowLocalProtocol( bool b );
100 100
101 /** 101 /**
102 * Sets the mode of the file dialog. 102 * Sets the mode of the file dialog.
103 * Note: you can only select one file with the filedialog, 103 * Note: you can only select one file with the filedialog,
104 * so KFile::Files doesn't make much sense. 104 * so KFile::Files doesn't make much sense.
105 * @see KFileDialog::setMode() 105 * @see KFileDialog::setMode()
106 */ 106 */
107 void setMode( unsigned int m ); 107 void setMode( unsigned int m );
108 void setPathIsDir( ) {mPathIsDir = true;}
108 109
109 /** 110 /**
110 * Sets the filter for the file dialog. 111 * Sets the filter for the file dialog.
111 * @see KFileDialog::setFilter() 112 * @see KFileDialog::setFilter()
112 */ 113 */
113 void setFilter( const QString& filter ); 114 void setFilter( const QString& filter );
114 115
115 /** 116 /**
116 * @returns whether local files will be prefixed with file:/ in the 117 * @returns whether local files will be prefixed with file:/ in the
117 * lineedit 118 * lineedit
118 * @see #setShowLocalProtocol 119 * @see #setShowLocalProtocol
119 */ 120 */
@@ -225,24 +226,25 @@ signals:
225 void urlSelected( const QString& ); 226 void urlSelected( const QString& );
226 227
227protected: 228protected:
228 void init(); 229 void init();
229 230
230//US KURLCompletion * myCompletion; 231//US KURLCompletion * myCompletion;
231 232
232 233
233private: 234private:
234 KURLDragPushButton * myButton; 235 KURLDragPushButton * myButton;
235 bool myShowLocalProt; 236 bool myShowLocalProt;
236 mutable KFileDialog * myFileDialog; 237 mutable KFileDialog * myFileDialog;
238 bool mPathIsDir;
237 239
238 240
239protected slots: 241protected slots:
240 /** 242 /**
241 * Called when the button is pressed to open the filedialog. 243 * Called when the button is pressed to open the filedialog.
242 * Also called when @ref KStdAccel::Open (default is Ctrl-O) is pressed. 244 * Also called when @ref KStdAccel::Open (default is Ctrl-O) is pressed.
243 */ 245 */
244 void slotOpenDialog(); 246 void slotOpenDialog();
245 247
246private slots: 248private slots:
247 void slotUpdateURL(); 249 void slotUpdateURL();
248 250