author | zautrix <zautrix> | 2005-04-27 23:23:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-27 23:23:17 (UTC) |
commit | 1540fc9be514330c76c999562fcf3e6bc1e2ffbb (patch) (unidiff) | |
tree | ade066f57be45f0d9783c0efa4e869fee337dd51 /microkde | |
parent | 3978688cbe832e2b72c8048b96c9a7c43ce11bc9 (diff) | |
download | kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.zip kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.gz kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.bz2 |
csv fixes
-rw-r--r-- | microkde/kfiledialog.cpp | 5 | ||||
-rw-r--r-- | microkde/kio/kfile/kurlrequester.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 3f47425..6be1580 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -1,76 +1,79 @@ | |||
1 | #include <kfiledialog.h> | 1 | #include <kfiledialog.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | #ifndef DESKTOP_VERSION | 8 | #ifndef DESKTOP_VERSION |
9 | //US orig#include <ofileselector.h> | 9 | //US orig#include <ofileselector.h> |
10 | #include <ofileselector_p.h> | 10 | #include <ofileselector_p.h> |
11 | QString KFileDialog::getSaveFileName( const QString & fn, | 11 | QString KFileDialog::getSaveFileName( const QString & fn, |
12 | const QString & cap , QWidget * par ) | 12 | const QString & cap , QWidget * par ) |
13 | { | 13 | { |
14 | QString retfile = ""; | 14 | QString retfile = ""; |
15 | QDialog dia ( par, "input-dialog", true ); | 15 | QDialog dia ( par, "input-dialog", true ); |
16 | QVBoxLayout lay( &dia ); | 16 | QVBoxLayout lay( &dia ); |
17 | lay.setMargin(7); | 17 | lay.setMargin(7); |
18 | lay.setSpacing(7); | 18 | lay.setSpacing(7); |
19 | QString file = fn; | 19 | QString file = fn; |
20 | if ( file.isEmpty() ) | 20 | if ( file.isEmpty() ) |
21 | file = QDir::homeDirPath()+"/*"; | 21 | file = QDir::homeDirPath()+"/*"; |
22 | QFileInfo fi ( file ); | 22 | QFileInfo fi ( file ); |
23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
25 | lay.addWidget( &o); | 25 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 26 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 27 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 28 | dia.showMaximized(); |
29 | dia.setCaption( cap ); | 29 | if ( cap.isEmpty() ) |
30 | dia.setCaption( file ); | ||
31 | else | ||
32 | dia.setCaption( cap ); | ||
30 | int res = dia.exec(); | 33 | int res = dia.exec(); |
31 | if ( res ) | 34 | if ( res ) |
32 | retfile = o.selectedName(); | 35 | retfile = o.selectedName(); |
33 | return retfile; | 36 | return retfile; |
34 | } | 37 | } |
35 | 38 | ||
36 | QString KFileDialog::getOpenFileName( const QString & fn, | 39 | QString KFileDialog::getOpenFileName( const QString & fn, |
37 | const QString & cap, QWidget * par ) | 40 | const QString & cap, QWidget * par ) |
38 | { | 41 | { |
39 | QString retfile = ""; | 42 | QString retfile = ""; |
40 | QDialog dia ( par, "input-dialog", true ); | 43 | QDialog dia ( par, "input-dialog", true ); |
41 | // QLineEdit lab ( &dia ); | 44 | // QLineEdit lab ( &dia ); |
42 | QVBoxLayout lay( &dia ); | 45 | QVBoxLayout lay( &dia ); |
43 | lay.setMargin(7); | 46 | lay.setMargin(7); |
44 | lay.setSpacing(7); | 47 | lay.setSpacing(7); |
45 | QString file = fn; | 48 | QString file = fn; |
46 | if ( file.isEmpty() ) | 49 | if ( file.isEmpty() ) |
47 | file = QDir::homeDirPath()+"/*";; | 50 | file = QDir::homeDirPath()+"/*";; |
48 | QFileInfo fi ( file ); | 51 | QFileInfo fi ( file ); |
49 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
50 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
51 | lay.addWidget( &o); | 54 | lay.addWidget( &o); |
52 | dia.showMaximized(); | 55 | dia.showMaximized(); |
53 | dia.setCaption( cap ); | 56 | dia.setCaption( cap ); |
54 | int res = dia.exec(); | 57 | int res = dia.exec(); |
55 | if ( res ) | 58 | if ( res ) |
56 | retfile = o.selectedName(); | 59 | retfile = o.selectedName(); |
57 | return retfile; | 60 | return retfile; |
58 | } | 61 | } |
59 | 62 | ||
60 | #else | 63 | #else |
61 | 64 | ||
62 | #include <qfiledialog.h> | 65 | #include <qfiledialog.h> |
63 | 66 | ||
64 | QString KFileDialog::getSaveFileName( const QString & fn, | 67 | QString KFileDialog::getSaveFileName( const QString & fn, |
65 | const QString & cap , QWidget * par ) | 68 | const QString & cap , QWidget * par ) |
66 | { | 69 | { |
67 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 70 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
68 | } | 71 | } |
69 | QString KFileDialog::getOpenFileName( const QString & fn, | 72 | QString KFileDialog::getOpenFileName( const QString & fn, |
70 | const QString & cap, QWidget * par ) | 73 | const QString & cap, QWidget * par ) |
71 | { | 74 | { |
72 | 75 | ||
73 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 76 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
74 | } | 77 | } |
75 | #endif | 78 | #endif |
76 | 79 | ||
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 | |||
@@ -1,406 +1,406 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org> | 2 | Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org> |
3 | 3 | ||
4 | library is free software; you can redistribute it and/or | 4 | library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2, as published by the Free Software Foundation. | 6 | License version 2, as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | 19 | ||
20 | #include <sys/stat.h> | 20 | #include <sys/stat.h> |
21 | #ifdef _WIN32_ | 21 | #ifdef _WIN32_ |
22 | 22 | ||
23 | #else | 23 | #else |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #endif | 25 | #endif |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | //US #include <qtooltip.h> | 27 | //US #include <qtooltip.h> |
28 | 28 | ||
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | 30 | ||
31 | //US #include <kaccel.h> | 31 | //US #include <kaccel.h> |
32 | //US #include <kcombobox.h> | 32 | //US #include <kcombobox.h> |
33 | #include <kdebug.h> | 33 | #include <kdebug.h> |
34 | #include <kdialog.h> | 34 | #include <kdialog.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include <klineedit.h> | 38 | #include <klineedit.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | //US #include <kurlcompletion.h> | 40 | //US #include <kurlcompletion.h> |
41 | //US #include <kurldrag.h> | 41 | //US #include <kurldrag.h> |
42 | //US #include <kprotocolinfo.h> | 42 | //US #include <kprotocolinfo.h> |
43 | 43 | ||
44 | 44 | ||
45 | #include "kurlrequester.h" | 45 | #include "kurlrequester.h" |
46 | 46 | ||
47 | 47 | ||
48 | class KURLDragPushButton : public QPushButton | 48 | class KURLDragPushButton : public QPushButton |
49 | { | 49 | { |
50 | public: | 50 | public: |
51 | KURLDragPushButton( QWidget *parent, const char *name=0 ) | 51 | KURLDragPushButton( QWidget *parent, const char *name=0 ) |
52 | : QPushButton( parent, name ) { | 52 | : QPushButton( parent, name ) { |
53 | //US setDragEnabled( true ); | 53 | //US setDragEnabled( true ); |
54 | } | 54 | } |
55 | ~KURLDragPushButton() {} | 55 | ~KURLDragPushButton() {} |
56 | 56 | ||
57 | void setURL( const KURL& url ) { | 57 | void setURL( const KURL& url ) { |
58 | m_urls.clear(); | 58 | m_urls.clear(); |
59 | m_urls.append( url ); | 59 | m_urls.append( url ); |
60 | } | 60 | } |
61 | 61 | ||
62 | /* not needed so far | 62 | /* not needed so far |
63 | void setURLs( const KURL::List& urls ) { | 63 | void setURLs( const KURL::List& urls ) { |
64 | m_urls = urls; | 64 | m_urls = urls; |
65 | } | 65 | } |
66 | const KURL::List& urls() const { return m_urls; } | 66 | const KURL::List& urls() const { return m_urls; } |
67 | */ | 67 | */ |
68 | 68 | ||
69 | protected: | 69 | protected: |
70 | /*US | 70 | /*US |
71 | virtual QDragObject *dragObject() { | 71 | virtual QDragObject *dragObject() { |
72 | if ( m_urls.isEmpty() ) | 72 | if ( m_urls.isEmpty() ) |
73 | return 0L; | 73 | return 0L; |
74 | 74 | ||
75 | QDragObject *drag = KURLDrag::newDrag( m_urls, this, "url drag" ); | 75 | QDragObject *drag = KURLDrag::newDrag( m_urls, this, "url drag" ); |
76 | return drag; | 76 | return drag; |
77 | } | 77 | } |
78 | */ | 78 | */ |
79 | private: | 79 | private: |
80 | KURL::List m_urls; | 80 | KURL::List m_urls; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
85 | /* | 85 | /* |
86 | ************************************************************************* | 86 | ************************************************************************* |
87 | */ | 87 | */ |
88 | 88 | ||
89 | class KURLRequester::KURLRequesterPrivate | 89 | class KURLRequester::KURLRequesterPrivate |
90 | { | 90 | { |
91 | public: | 91 | public: |
92 | KURLRequesterPrivate() { | 92 | KURLRequesterPrivate() { |
93 | edit = 0L; | 93 | edit = 0L; |
94 | //UScombo = 0L; | 94 | //UScombo = 0L; |
95 | //US fileDialogMode = KFile::File | KFile::ExistingOnly | KFile::LocalOnly; | 95 | //US fileDialogMode = KFile::File | KFile::ExistingOnly | KFile::LocalOnly; |
96 | } | 96 | } |
97 | 97 | ||
98 | void setText( const QString& text ) { | 98 | void setText( const QString& text ) { |
99 | /*US | 99 | /*US |
100 | if ( combo ) | 100 | if ( combo ) |
101 | { | 101 | { |
102 | if (combo->editable()) | 102 | if (combo->editable()) |
103 | { | 103 | { |
104 | combo->setEditText( text ); | 104 | combo->setEditText( text ); |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { | 107 | { |
108 | combo->insertItem( text ); | 108 | combo->insertItem( text ); |
109 | combo->setCurrentItem( combo->count()-1 ); | 109 | combo->setCurrentItem( combo->count()-1 ); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | else | 112 | else |
113 | */ | 113 | */ |
114 | { | 114 | { |
115 | edit->setText( text ); | 115 | edit->setText( text ); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | void connectSignals( QObject *receiver ) { | 119 | void connectSignals( QObject *receiver ) { |
120 | QObject *sender; | 120 | QObject *sender; |
121 | /*USif ( combo ) | 121 | /*USif ( combo ) |
122 | sender = combo; | 122 | sender = combo; |
123 | else | 123 | else |
124 | */ | 124 | */ |
125 | sender = edit; | 125 | sender = edit; |
126 | 126 | ||
127 | connect( sender, SIGNAL( textChanged( const QString& )), | 127 | connect( sender, SIGNAL( textChanged( const QString& )), |
128 | receiver, SIGNAL( textChanged( const QString& ))); | 128 | receiver, SIGNAL( textChanged( const QString& ))); |
129 | connect( sender, SIGNAL( returnPressed() ), | 129 | connect( sender, SIGNAL( returnPressed() ), |
130 | receiver, SIGNAL( returnPressed() )); | 130 | receiver, SIGNAL( returnPressed() )); |
131 | //USconnect( sender, SIGNAL( returnPressed( const QString& ) ), | 131 | //USconnect( sender, SIGNAL( returnPressed( const QString& ) ), |
132 | //US receiver, SIGNAL( returnPressed( const QString& ) )); | 132 | //US receiver, SIGNAL( returnPressed( const QString& ) )); |
133 | } | 133 | } |
134 | /*US | 134 | /*US |
135 | void setCompletionObject( KCompletion *comp ) { | 135 | void setCompletionObject( KCompletion *comp ) { |
136 | if ( combo ) | 136 | if ( combo ) |
137 | combo->setCompletionObject( comp ); | 137 | combo->setCompletionObject( comp ); |
138 | else | 138 | else |
139 | edit->setCompletionObject( comp ); | 139 | edit->setCompletionObject( comp ); |
140 | } | 140 | } |
141 | */ | 141 | */ |
142 | /** | 142 | /** |
143 | * replaces ~user or $FOO, if necessary | 143 | * replaces ~user or $FOO, if necessary |
144 | */ | 144 | */ |
145 | QString url() { | 145 | QString url() { |
146 | QString txt = /*US combo ? combo->currentText() : */ edit->text(); | 146 | QString txt = /*US combo ? combo->currentText() : */ edit->text(); |
147 | /*US KURLCompletion *comp; | 147 | /*US KURLCompletion *comp; |
148 | if ( combo ) | 148 | if ( combo ) |
149 | comp = dynamic_cast<KURLCompletion*>(combo->completionObject()); | 149 | comp = dynamic_cast<KURLCompletion*>(combo->completionObject()); |
150 | else | 150 | else |
151 | comp = dynamic_cast<KURLCompletion*>(edit->completionObject()); | 151 | comp = dynamic_cast<KURLCompletion*>(edit->completionObject()); |
152 | 152 | ||
153 | if ( comp ) | 153 | if ( comp ) |
154 | return comp->replacedPath( txt ); | 154 | return comp->replacedPath( txt ); |
155 | else | 155 | else |
156 | */ | 156 | */ |
157 | return txt; | 157 | return txt; |
158 | } | 158 | } |
159 | 159 | ||
160 | KLineEdit *edit; | 160 | KLineEdit *edit; |
161 | //US KComboBox *combo; | 161 | //US KComboBox *combo; |
162 | int fileDialogMode; | 162 | int fileDialogMode; |
163 | QString fileDialogFilter; | 163 | QString fileDialogFilter; |
164 | }; | 164 | }; |
165 | 165 | ||
166 | 166 | ||
167 | /*US | 167 | /*US |
168 | KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent, | 168 | KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent, |
169 | const char *name ) | 169 | const char *name ) |
170 | : QHBox( parent, name ) | 170 | : QHBox( parent, name ) |
171 | { | 171 | { |
172 | d = new KURLRequesterPrivate; | 172 | d = new KURLRequesterPrivate; |
173 | 173 | ||
174 | // must have this as parent | 174 | // must have this as parent |
175 | editWidget->reparent( this, 0, QPoint(0,0) ); | 175 | editWidget->reparent( this, 0, QPoint(0,0) ); |
176 | //US d->edit = dynamic_cast<KLineEdit*>( editWidget ); | 176 | //US d->edit = dynamic_cast<KLineEdit*>( editWidget ); |
177 | d->edit = (KLineEdit*)( editWidget ); | 177 | d->edit = (KLineEdit*)( editWidget ); |
178 | //US d->combo = dynamic_cast<KComboBox*>( editWidget ); | 178 | //US d->combo = dynamic_cast<KComboBox*>( editWidget ); |
179 | 179 | ||
180 | init(); | 180 | init(); |
181 | } | 181 | } |
182 | */ | 182 | */ |
183 | 183 | ||
184 | KURLRequester::KURLRequester( QWidget *parent, const char *name ) | 184 | KURLRequester::KURLRequester( QWidget *parent, const char *name ) |
185 | : QHBox( parent, name ) | 185 | : QHBox( parent, name ) |
186 | { | 186 | { |
187 | d = new KURLRequesterPrivate; | 187 | d = new KURLRequesterPrivate; |
188 | init(); | 188 | init(); |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | KURLRequester::KURLRequester( const QString& url, QWidget *parent, | 192 | KURLRequester::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 | ||
202 | KURLRequester::~KURLRequester() | 202 | KURLRequester::~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 | ||
210 | void KURLRequester::init() | 210 | void KURLRequester::init() |
211 | { | 211 | { |
212 | myFileDialog = 0L; | 212 | myFileDialog = 0L; |
213 | myShowLocalProt = false; | 213 | myShowLocalProt = false; |
214 | 214 | ||
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 ); |
239 | accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() )); | 239 | accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() )); |
240 | accel->readSettings(); | 240 | accel->readSettings(); |
241 | */ | 241 | */ |
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | void KURLRequester::setURL( const QString& url ) | 245 | void KURLRequester::setURL( const QString& url ) |
246 | { | 246 | { |
247 | bool hasLocalPrefix = (url.startsWith("file:")); | 247 | bool hasLocalPrefix = (url.startsWith("file:")); |
248 | 248 | ||
249 | if ( !myShowLocalProt && hasLocalPrefix ) | 249 | if ( !myShowLocalProt && hasLocalPrefix ) |
250 | d->setText( url.mid( 5, url.length()-5 )); | 250 | d->setText( url.mid( 5, url.length()-5 )); |
251 | else | 251 | else |
252 | d->setText( url ); | 252 | d->setText( url ); |
253 | } | 253 | } |
254 | 254 | ||
255 | void KURLRequester::setCaption( const QString& caption ) | 255 | void 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 | ||
261 | QString KURLRequester::url() const | 261 | QString KURLRequester::url() const |
262 | { | 262 | { |
263 | return d->url(); | 263 | return d->url(); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void KURLRequester::slotOpenDialog() | 267 | void 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, "Save backup filename", this ); | 275 | fn = KFileDialog::getSaveFileName( fn, "", this ); |
276 | 276 | ||
277 | if ( fn == "" ) | 277 | if ( fn == "" ) |
278 | return; | 278 | return; |
279 | 279 | ||
280 | setURL( fn ); | 280 | setURL( fn ); |
281 | emit urlSelected( d->url() ); | 281 | emit urlSelected( d->url() ); |
282 | /*US | 282 | /*US |
283 | KFileDialog *dlg = fileDialog(); | 283 | KFileDialog *dlg = fileDialog(); |
284 | if ( !d->url().isEmpty() ) { | 284 | if ( !d->url().isEmpty() ) { |
285 | KURL u( url() ); | 285 | KURL u( url() ); |
286 | // If we won't be able to list it (e.g. http), then don't try :) | 286 | // If we won't be able to list it (e.g. http), then don't try :) |
287 | if ( KProtocolInfo::supportsListing( u.protocol() ) ) | 287 | if ( KProtocolInfo::supportsListing( u.protocol() ) ) |
288 | dlg->setSelection( u.url() ); | 288 | dlg->setSelection( u.url() ); |
289 | } | 289 | } |
290 | 290 | ||
291 | if ( dlg->exec() == QDialog::Accepted ) | 291 | if ( dlg->exec() == QDialog::Accepted ) |
292 | { | 292 | { |
293 | setURL( dlg->selectedURL().prettyURL() ); | 293 | setURL( dlg->selectedURL().prettyURL() ); |
294 | emit urlSelected( d->url() ); | 294 | emit urlSelected( d->url() ); |
295 | } | 295 | } |
296 | */ | 296 | */ |
297 | 297 | ||
298 | } | 298 | } |
299 | 299 | ||
300 | void KURLRequester::setMode(unsigned int mode) | 300 | void KURLRequester::setMode(unsigned int mode) |
301 | { | 301 | { |
302 | /*US | 302 | /*US |
303 | Q_ASSERT( (mode & KFile::Files) == 0 ); | 303 | Q_ASSERT( (mode & KFile::Files) == 0 ); |
304 | d->fileDialogMode = mode; | 304 | d->fileDialogMode = mode; |
305 | if ( (mode & KFile::Directory) && !(mode & KFile::File) ) | 305 | if ( (mode & KFile::Directory) && !(mode & KFile::File) ) |
306 | myCompletion->setMode( KURLCompletion::DirCompletion ); | 306 | myCompletion->setMode( KURLCompletion::DirCompletion ); |
307 | 307 | ||
308 | if (myFileDialog) | 308 | if (myFileDialog) |
309 | myFileDialog->setMode( d->fileDialogMode ); | 309 | myFileDialog->setMode( d->fileDialogMode ); |
310 | */ | 310 | */ |
311 | } | 311 | } |
312 | 312 | ||
313 | void KURLRequester::setFilter(const QString &filter) | 313 | void KURLRequester::setFilter(const QString &filter) |
314 | { | 314 | { |
315 | /*US | 315 | /*US |
316 | d->fileDialogFilter = filter; | 316 | d->fileDialogFilter = filter; |
317 | if (myFileDialog) | 317 | if (myFileDialog) |
318 | myFileDialog->setFilter( d->fileDialogFilter ); | 318 | myFileDialog->setFilter( d->fileDialogFilter ); |
319 | */ | 319 | */ |
320 | } | 320 | } |
321 | 321 | ||
322 | KFileDialog * KURLRequester::fileDialog() const | 322 | KFileDialog * KURLRequester::fileDialog() const |
323 | { | 323 | { |
324 | /*US | 324 | /*US |
325 | if ( !myFileDialog ) { | 325 | if ( !myFileDialog ) { |
326 | QWidget *p = parentWidget(); | 326 | QWidget *p = parentWidget(); |
327 | myFileDialog = new KFileDialog( QString::null, QString::null, p, | 327 | myFileDialog = new KFileDialog( QString::null, QString::null, p, |
328 | "file dialog", true ); | 328 | "file dialog", true ); |
329 | 329 | ||
330 | myFileDialog->setMode( d->fileDialogMode ); | 330 | myFileDialog->setMode( d->fileDialogMode ); |
331 | myFileDialog->setFilter( d->fileDialogFilter ); | 331 | myFileDialog->setFilter( d->fileDialogFilter ); |
332 | } | 332 | } |
333 | 333 | ||
334 | return myFileDialog; | 334 | return myFileDialog; |
335 | */ | 335 | */ |
336 | return 0; | 336 | return 0; |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
340 | void KURLRequester::setShowLocalProtocol( bool b ) | 340 | void KURLRequester::setShowLocalProtocol( bool b ) |
341 | { | 341 | { |
342 | if ( myShowLocalProt == b ) | 342 | if ( myShowLocalProt == b ) |
343 | return; | 343 | return; |
344 | 344 | ||
345 | myShowLocalProt = b; | 345 | myShowLocalProt = b; |
346 | setURL( url() ); | 346 | setURL( url() ); |
347 | } | 347 | } |
348 | 348 | ||
349 | void KURLRequester::clear() | 349 | void KURLRequester::clear() |
350 | { | 350 | { |
351 | d->setText( QString::null ); | 351 | d->setText( QString::null ); |
352 | } | 352 | } |
353 | 353 | ||
354 | KLineEdit * KURLRequester::lineEdit() const | 354 | KLineEdit * KURLRequester::lineEdit() const |
355 | { | 355 | { |
356 | return d->edit; | 356 | return d->edit; |
357 | } | 357 | } |
358 | /*US | 358 | /*US |
359 | KComboBox * KURLRequester::comboBox() const | 359 | KComboBox * KURLRequester::comboBox() const |
360 | { | 360 | { |
361 | return d->combo; | 361 | return d->combo; |
362 | } | 362 | } |
363 | */ | 363 | */ |
364 | void KURLRequester::slotUpdateURL() | 364 | void KURLRequester::slotUpdateURL() |
365 | { | 365 | { |
366 | // bin compat, myButton is declared as QPushButton | 366 | // bin compat, myButton is declared as QPushButton |
367 | //US KURL u( QDir::currentDirPath() + '/', url() ); | 367 | //US KURL u( QDir::currentDirPath() + '/', url() ); |
368 | KURL u( url() ); | 368 | KURL u( url() ); |
369 | (static_cast<KURLDragPushButton *>( myButton))->setURL( u ); | 369 | (static_cast<KURLDragPushButton *>( myButton))->setURL( u ); |
370 | } | 370 | } |
371 | 371 | ||
372 | QPushButton * KURLRequester::button() const | 372 | QPushButton * KURLRequester::button() const |
373 | { | 373 | { |
374 | return myButton; | 374 | return myButton; |
375 | } | 375 | } |
376 | /*US | 376 | /*US |
377 | KEditListBox::CustomEditor KURLRequester::customEditor() | 377 | KEditListBox::CustomEditor KURLRequester::customEditor() |
378 | { | 378 | { |
379 | setSizePolicy(QSizePolicy( QSizePolicy::Preferred, | 379 | setSizePolicy(QSizePolicy( QSizePolicy::Preferred, |
380 | QSizePolicy::Fixed)); | 380 | QSizePolicy::Fixed)); |
381 | 381 | ||
382 | KLineEdit *edit = d->edit; | 382 | KLineEdit *edit = d->edit; |
383 | if ( !edit && d->combo ) | 383 | if ( !edit && d->combo ) |
384 | edit = dynamic_cast<KLineEdit*>( d->combo->lineEdit() ); | 384 | edit = dynamic_cast<KLineEdit*>( d->combo->lineEdit() ); |
385 | 385 | ||
386 | #ifndef NDEBUG | 386 | #ifndef NDEBUG |
387 | if ( !edit ) | 387 | if ( !edit ) |
388 | kdWarning() << "KURLRequester's lineedit is not a KLineEdit!??\n"; | 388 | kdWarning() << "KURLRequester's lineedit is not a KLineEdit!??\n"; |
389 | #endif | 389 | #endif |
390 | 390 | ||
391 | KEditListBox::CustomEditor editor( this, edit ); | 391 | KEditListBox::CustomEditor editor( this, edit ); |
392 | return editor; | 392 | return editor; |
393 | } | 393 | } |
394 | */ | 394 | */ |
395 | void KURLRequester::virtual_hook( int, void* ) | 395 | void KURLRequester::virtual_hook( int, void* ) |
396 | { /*BASE::virtual_hook( id, data );*/ } | 396 | { /*BASE::virtual_hook( id, data );*/ } |
397 | 397 | ||
398 | /*US | 398 | /*US |
399 | KURLComboRequester::KURLComboRequester( QWidget *parent, | 399 | KURLComboRequester::KURLComboRequester( QWidget *parent, |
400 | const char *name ) | 400 | const char *name ) |
401 | : KURLRequester( new KComboBox(false), parent, name) | 401 | : KURLRequester( new KComboBox(false), parent, name) |
402 | { | 402 | { |
403 | } | 403 | } |
404 | */ | 404 | */ |
405 | 405 | ||
406 | //US #include "kurlrequester.moc" | 406 | //US #include "kurlrequester.moc" |