summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index f2a0c7b..2d38961 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -103,152 +103,151 @@ OFileDialog::OFileDialog(const QString &caption,
103 dirName, fileName, 103 dirName, fileName,
104 mimetypes ); 104 mimetypes );
105 lay->addWidget( file ); 105 lay->addWidget( file );
106 106
107 setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); 107 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
108 connect(file, SIGNAL(fileSelected(const QString&) ), 108 connect(file, SIGNAL(fileSelected(const QString&) ),
109 this, SLOT(slotFileSelected(const QString&) ) ); 109 this, SLOT(slotFileSelected(const QString&) ) );
110 connect(file, SIGNAL(ok() ), 110 connect(file, SIGNAL(ok() ),
111 this, SLOT(slotSelectorOk()) ) ; 111 this, SLOT(slotSelectorOk()) ) ;
112 112
113 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) ); 113 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) );
114} 114}
115/** 115/**
116 * @returns the mimetype of the selected 116 * @returns the mimetype of the selected
117 * currently it return QString::null 117 * currently it return QString::null
118 */ 118 */
119QString OFileDialog::mimetype()const 119QString OFileDialog::mimetype()const
120{ 120{
121 return QString::null; 121 return QString::null;
122} 122}
123 123
124/** 124/**
125 * @return the fileName 125 * @return the fileName
126 */ 126 */
127QString OFileDialog::fileName()const 127QString OFileDialog::fileName()const
128{ 128{
129 return file->selectedName(); 129 return file->selectedName();
130} 130}
131 131
132/** 132/**
133 * return a DocLnk to the current file 133 * return a DocLnk to the current file
134 */ 134 */
135DocLnk OFileDialog::selectedDocument()const 135DocLnk OFileDialog::selectedDocument()const
136{ 136{
137 return file->selectedDocument(); 137 return file->selectedDocument();
138} 138}
139 139
140/** 140/**
141 * This opens up a filedialog in Open mode 141 * This opens up a filedialog in Open mode
142 * 142 *
143 * @param selector the Selector Mode 143 * @param selector the Selector Mode
144 * @param startDir Where to start from 144 * @param startDir Where to start from
145 * @param file A proposed filename 145 * @param file A proposed filename
146 * @param mimes A list of MimeTypes 146 * @param mimes A list of MimeTypes
147 * @param wid the parent 147 * @param wid the parent
148 * @param caption of the dialog if QString::null tr("Open") will be used 148 * @param caption of the dialog if QString::null tr("Open") will be used
149 * @return the fileName or QString::null 149 * @return the fileName or QString::null
150 */ 150 */
151QString OFileDialog::getOpenFileName(int selector, 151QString OFileDialog::getOpenFileName(int selector,
152 const QString &_startDir, 152 const QString &_startDir,
153 const QString &file, 153 const QString &file,
154 const MimeTypes &mimes, 154 const MimeTypes &mimes,
155 QWidget *wid, 155 QWidget *wid,
156 const QString &caption ) 156 const QString &caption )
157{ 157{
158 QString ret; 158 QString ret;
159 QString startDir = _startDir; 159 QString startDir = _startDir;
160 if (startDir.isEmpty() ) 160 if (startDir.isEmpty() )
161 startDir = lastUsedDir( "FileDialog-OPEN" ); 161 startDir = lastUsedDir( "FileDialog-OPEN" );
162 162
163 163
164 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, 164 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption,
165 wid, OFileSelector::Open, selector, startDir, file, mimes); 165 wid, OFileSelector::Open, selector, startDir, file, mimes);
166 if( QPEApplication::execDialog(&dlg ) ) 166 if( QPEApplication::execDialog(&dlg ) )
167 { 167 {
168 ret = dlg.fileName(); 168 ret = dlg.fileName();
169 saveLastDir( "FileDialog-OPEN", ret ); 169 saveLastDir( "FileDialog-OPEN", ret );
170 } 170 }
171 171
172 return ret; 172 return ret;
173} 173}
174 174
175/** 175/**
176 * This opens up a file dialog in save mode 176 * This opens up a file dialog in save mode
177 * @see getOpenFileName 177 * @see getOpenFileName
178 */ 178 */
179QString OFileDialog::getSaveFileName(int selector, 179QString OFileDialog::getSaveFileName(int selector,
180 const QString &_startDir, 180 const QString &_startDir,
181 const QString &file, 181 const QString &file,
182 const MimeTypes &mimes, 182 const MimeTypes &mimes,
183 QWidget *wid, 183 QWidget *wid,
184 const QString &caption ) 184 const QString &caption )
185{ 185{
186 QString ret; 186 QString ret;
187 QString startDir = _startDir; 187 QString startDir = _startDir;
188 if (startDir.isEmpty() ) 188 if (startDir.isEmpty() )
189 startDir = lastUsedDir( "FileDialog-SAVE" ); 189 startDir = lastUsedDir( "FileDialog-SAVE" );
190 190
191 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, 191 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
192 wid, OFileSelector::Save, selector, startDir, file, mimes); 192 wid, OFileSelector::Save, selector, startDir, file, mimes);
193 193
194 /* 194 /*
195 * For the save mode we do not want a file to be written 195 * For the save mode we do not want a file to be written
196 * if the user just clicked on it 196 * if the user just clicked on it
197 * #1522 197 * #1522
198 */ 198 */
199 dlg.disconnect( dlg.file, SIGNAL(fileSelected(const QString&)) ); 199 dlg.file->disconnect( &dlg );
200 dlg.disconnect( dlg.file, SIGNAL(ok()) );
201 200
202 if( QPEApplication::execDialog(&dlg) ) 201 if( QPEApplication::execDialog(&dlg) )
203 { 202 {
204 ret = dlg.fileName(); 203 ret = dlg.fileName();
205 saveLastDir( "FileDialog-SAVE", ret ); 204 saveLastDir( "FileDialog-SAVE", ret );
206 } 205 }
207 206
208 return ret; 207 return ret;
209} 208}
210 209
211/** 210/**
212 * This opens up a filedialog in select directory mode 211 * This opens up a filedialog in select directory mode
213 * 212 *
214 * @param selector the Selector Mode 213 * @param selector the Selector Mode
215 * @param startDir Where to start from 214 * @param startDir Where to start from
216 * @param wid the parent 215 * @param wid the parent
217 * @param caption of the dialog if QString::null tr("Open") will be used 216 * @param caption of the dialog if QString::null tr("Open") will be used
218 * @return the directoryName or QString::null 217 * @return the directoryName or QString::null
219 */ 218 */
220QString OFileDialog::getDirectory(int selector, 219QString OFileDialog::getDirectory(int selector,
221 const QString &_startDir, 220 const QString &_startDir,
222 QWidget *wid, 221 QWidget *wid,
223 const QString &caption ) 222 const QString &caption )
224{ 223{
225 QString ret; 224 QString ret;
226 QString startDir = _startDir; 225 QString startDir = _startDir;
227 if ( startDir.isEmpty() ) 226 if ( startDir.isEmpty() )
228 startDir = lastUsedDir( "FileDialog-SELECTDIR" ); 227 startDir = lastUsedDir( "FileDialog-SELECTDIR" );
229 228
230 OFileDialog dlg( caption.isEmpty() ? tr( "Select Directory" ) : caption, 229 OFileDialog dlg( caption.isEmpty() ? tr( "Select Directory" ) : caption,
231 wid, OFileSelector::DirectorySelector, selector, startDir ); 230 wid, OFileSelector::DirectorySelector, selector, startDir );
232 231
233 if ( QPEApplication::execDialog(&dlg) ) 232 if ( QPEApplication::execDialog(&dlg) )
234 { 233 {
235 ret = dlg.fileName(); 234 ret = dlg.fileName();
236 saveLastDir( "FileDialog-SELECTDIR", ret ); 235 saveLastDir( "FileDialog-SELECTDIR", ret );
237 } 236 }
238 return ret; 237 return ret;
239} 238}
240 239
241void OFileDialog::slotFileSelected(const QString & ) 240void OFileDialog::slotFileSelected(const QString & )
242{ 241{
243 accept(); 242 accept();
244} 243}
245 244
246void OFileDialog::slotSelectorOk( ) 245void OFileDialog::slotSelectorOk( )
247{ 246{
248 accept(); 247 accept();
249} 248}
250 249
251void OFileDialog::slotDirSelected(const QString &dir ) 250void OFileDialog::slotDirSelected(const QString &dir )
252{ 251{
253 setCaption( dir ); 252 setCaption( dir );
254} 253}