Diffstat (limited to 'libopie2/opieui/fileselector/ofiledialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofiledialog.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp index beb4d6c..ebce0ef 100644 --- a/libopie2/opieui/fileselector/ofiledialog.cpp +++ b/libopie2/opieui/fileselector/ofiledialog.cpp | |||
@@ -72,3 +72,6 @@ void saveLastDir( const QString& key, const QString& file ) | |||
72 | QFileInfo inf( file ); | 72 | QFileInfo inf( file ); |
73 | if ( inf.isFile() ) | ||
73 | cfg.writeEntry("LastDir", inf.dirPath( true ) ); | 74 | cfg.writeEntry("LastDir", inf.dirPath( true ) ); |
75 | else | ||
76 | cfg.writeEntry("LastDir", file ); | ||
74 | } | 77 | } |
@@ -206,2 +209,32 @@ QString OFileDialog::getSaveFileName(int selector, | |||
206 | 209 | ||
210 | /** | ||
211 | * This opens up a filedialog in select directory mode | ||
212 | * | ||
213 | * @param selector the Selector Mode | ||
214 | * @param startDir Where to start from | ||
215 | * @param wid the parent | ||
216 | * @param caption of the dialog if QString::null tr("Open") will be used | ||
217 | * @return the directoryName or QString::null | ||
218 | */ | ||
219 | QString OFileDialog::getDirectory(int selector, | ||
220 | const QString &_startDir, | ||
221 | QWidget *wid, | ||
222 | const QString &caption ) | ||
223 | { | ||
224 | QString ret; | ||
225 | QString startDir = _startDir; | ||
226 | if ( startDir.isEmpty() ) | ||
227 | startDir = lastUsedDir( "FileDialog-SELECTDIR" ); | ||
228 | |||
229 | OFileDialog dlg( caption.isEmpty() ? tr( "Select Directory" ) : caption, | ||
230 | wid, OFileSelector::DirectorySelector, selector, startDir ); | ||
231 | dlg.showMaximized(); | ||
232 | if ( dlg.exec() ) | ||
233 | { | ||
234 | ret = dlg.fileName(); | ||
235 | saveLastDir( "FileDialog-SELECTDIR", ret ); | ||
236 | } | ||
237 | return ret; | ||
238 | } | ||
239 | |||
207 | void OFileDialog::slotFileSelected(const QString & ) | 240 | void OFileDialog::slotFileSelected(const QString & ) |