summaryrefslogtreecommitdiffabout
path: root/microkde/kio/kfile/kurlrequester.cpp
authorzautrix <zautrix>2005-04-27 23:23:17 (UTC)
committer zautrix <zautrix>2005-04-27 23:23:17 (UTC)
commit1540fc9be514330c76c999562fcf3e6bc1e2ffbb (patch) (side-by-side diff)
treeade066f57be45f0d9783c0efa4e869fee337dd51 /microkde/kio/kfile/kurlrequester.cpp
parent3978688cbe832e2b72c8048b96c9a7c43ce11bc9 (diff)
downloadkdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.zip
kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.gz
kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.bz2
csv fixes
Diffstat (limited to 'microkde/kio/kfile/kurlrequester.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index 6d39308..991c8be 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -147,257 +147,257 @@ public:
/*US KURLCompletion *comp;
if ( combo )
comp = dynamic_cast<KURLCompletion*>(combo->completionObject());
else
comp = dynamic_cast<KURLCompletion*>(edit->completionObject());
if ( comp )
return comp->replacedPath( txt );
else
*/
return txt;
}
KLineEdit *edit;
//US KComboBox *combo;
int fileDialogMode;
QString fileDialogFilter;
};
/*US
KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent,
const char *name )
: QHBox( parent, name )
{
d = new KURLRequesterPrivate;
// must have this as parent
editWidget->reparent( this, 0, QPoint(0,0) );
//US d->edit = dynamic_cast<KLineEdit*>( editWidget );
d->edit = (KLineEdit*)( editWidget );
//US d->combo = dynamic_cast<KComboBox*>( editWidget );
init();
}
*/
KURLRequester::KURLRequester( QWidget *parent, const char *name )
: QHBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
}
KURLRequester::KURLRequester( const QString& url, QWidget *parent,
const char *name )
: QHBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
setURL( url );
}
KURLRequester::~KURLRequester()
{
//US delete myCompletion;
delete myFileDialog;
delete d;
}
void KURLRequester::init()
{
myFileDialog = 0L;
myShowLocalProt = 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 );
d->connectSignals( this );
connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() ));
/*US
myCompletion = new KURLCompletion();
d->setCompletionObject( myCompletion );
KAccel *accel = new KAccel( this );
accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() ));
accel->readSettings();
*/
}
void KURLRequester::setURL( const QString& url )
{
bool hasLocalPrefix = (url.startsWith("file:"));
if ( !myShowLocalProt && hasLocalPrefix )
d->setText( url.mid( 5, url.length()-5 ));
else
d->setText( url );
}
void KURLRequester::setCaption( const QString& caption )
{
//US fileDialog()->setCaption( caption );
//US QWidget::setCaption( 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, "Save backup filename", this );
+ 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 )
{
setURL( dlg->selectedURL().prettyURL() );
emit urlSelected( d->url() );
}
*/
}
void KURLRequester::setMode(unsigned int mode)
{
/*US
Q_ASSERT( (mode & KFile::Files) == 0 );
d->fileDialogMode = mode;
if ( (mode & KFile::Directory) && !(mode & KFile::File) )
myCompletion->setMode( KURLCompletion::DirCompletion );
if (myFileDialog)
myFileDialog->setMode( d->fileDialogMode );
*/
}
void KURLRequester::setFilter(const QString &filter)
{
/*US
d->fileDialogFilter = filter;
if (myFileDialog)
myFileDialog->setFilter( d->fileDialogFilter );
*/
}
KFileDialog * KURLRequester::fileDialog() const
{
/*US
if ( !myFileDialog ) {
QWidget *p = parentWidget();
myFileDialog = new KFileDialog( QString::null, QString::null, p,
"file dialog", true );
myFileDialog->setMode( d->fileDialogMode );
myFileDialog->setFilter( d->fileDialogFilter );
}
return myFileDialog;
*/
return 0;
}
void KURLRequester::setShowLocalProtocol( bool b )
{
if ( myShowLocalProt == b )
return;
myShowLocalProt = b;
setURL( url() );
}
void KURLRequester::clear()
{
d->setText( QString::null );
}
KLineEdit * KURLRequester::lineEdit() const
{
return d->edit;
}
/*US
KComboBox * KURLRequester::comboBox() const
{
return d->combo;
}
*/
void KURLRequester::slotUpdateURL()
{
// bin compat, myButton is declared as QPushButton
//US KURL u( QDir::currentDirPath() + '/', url() );
KURL u( url() );
(static_cast<KURLDragPushButton *>( myButton))->setURL( u );
}
QPushButton * KURLRequester::button() const
{
return myButton;
}
/*US
KEditListBox::CustomEditor KURLRequester::customEditor()
{
setSizePolicy(QSizePolicy( QSizePolicy::Preferred,
QSizePolicy::Fixed));
KLineEdit *edit = d->edit;
if ( !edit && d->combo )
edit = dynamic_cast<KLineEdit*>( d->combo->lineEdit() );
#ifndef NDEBUG
if ( !edit )
kdWarning() << "KURLRequester's lineedit is not a KLineEdit!??\n";
#endif
KEditListBox::CustomEditor editor( this, edit );
return editor;
}
*/
void KURLRequester::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
/*US
KURLComboRequester::KURLComboRequester( QWidget *parent,
const char *name )
: KURLRequester( new KComboBox(false), parent, name)
{
}