Commit 5b4b06aa authored by Stéphane Albert's avatar Stéphane Albert

BUG: MANTIS-1180: Removed Qt working dir functions from mvd::I18nMainWindow.

parent c650e27a
......@@ -107,111 +107,6 @@ public:
*/
void Initialize();
/**
* \brief This is a convenience static method that will return an
* existing directory path selected by the user.
*
* This method stores the last accepted directory for next call.
*
* \see http://qt-project.org/doc/qt-4.8/qfiledialog.html#getExistingDirectory
*
* \param parent Parent widget of that QFileDialog.
* \param caption Title-bar caption of that QFileDialog.
* \param dir Directory location where to pick path.
* \param options of that QFileDialog.
*
* \return The selected path or an null QString if QFileDialog has
* been rejected.
*/
static inline
QString
GetExistingDirectory( QWidget* p =0,
const QString& caption =QString(),
const QString& dir = QString(),
QFileDialog::Options options =QFileDialog::ShowDirsOnly
);
/**
* \brief This is a convenience static method that will return an
* existing filename selected by the user.
*
* This method stores the last accepted directory for next call.
*
* \see http://qt-project.org/doc/qt-4.8/qfiledialog.html#getOpenFileName
*
* \param parent Parent widget of that QFileDialog.
* \param caption Title-bar caption of that QFileDialog.
* \param dir Directory location where to pick path.
* \param filter Filename filter (e.g. wildcards).
* \param selectedFilter Filter which has been selected by the user.
* \param options Options of that QFileDialog.
*
* \return The selected filename or an null QString if QFileDialog has
* been rejected.
*/
static inline
QString
GetOpenFileName( QWidget* p =0,
const QString& caption =QString(),
const QString& dir = QString(),
const QString& filter = QString(),
QString* selectedFilter =0,
QFileDialog::Options options =0 );
/**
* \brief This is a convenience static method that will return a
* list of existing filenames selected by the user.
*
* This method stores the last accepted directory for next call.
*
* \see http://qt-project.org/doc/qt-4.8/qfiledialog.html#getOpenFileNames
*
* \param parent Parent widget of that QFileDialog.
* \param caption Title-bar caption of that QFileDialog.
* \param dir Directory location where to pick path.
* \param filter Filename filter (e.g. wildcards).
* \param selectedFilter Filter which has been selected by the user.
* \param options of that QFileDialog.
*
* \return The selected filename list or an empty QStringLIst if
* QFileDialog has been rejected.
*/
static inline
QStringList
GetOpenFileNames( QWidget* p =0,
const QString& caption =QString(),
const QString& dir =QString(),
const QString& filter =QString(),
QString* selectedFilter =0,
QFileDialog::Options options =0 );
/**
* \brief This is a convenience static method that will return a
* filename selected by the user. This file does not have to exist.
*
* This method stores the last accepted directory for next call.
*
* \see http://qt-project.org/doc/qt-4.8/qfiledialog.html#getSaveFileName
*
* \param parent Parent widget of that QFileDialog.
* \param caption Title-bar caption of that QFileDialog.
* \param dir Directory location where to pick path.
* \param filter Filename filter (e.g. wildcards).
* \param selectedFilter Filter which has been selected by the user.
* \param options of that QFileDialog.
*
* \return The selected filename list or an empty QStringLIst if
* QFileDialog has been rejected.
*/
static inline
QString
GetSaveFileName( QWidget* p =0,
const QString& caption =QString(),
const QString& dir =QString(),
const QString& filter =QString(),
QString* selectedFilter =0,
QFileDialog::Options options =0 );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
......@@ -350,11 +245,6 @@ private:
// Private attributes.
private:
/**
* \brief Holds the last location accepted using QFileDialog.
*/
static QDir m_LastAcceptedDir;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
//
......@@ -504,116 +394,6 @@ I18nMainWindow
return dockWidget;
}
/*****************************************************************************/
inline
QString
I18nMainWindow
::GetExistingDirectory( QWidget* p,
const QString& caption,
const QString& dir,
QFileDialog::Options options )
{
QString path(
QFileDialog::getExistingDirectory(
p,
caption,
dir.isEmpty() ? I18nMainWindow::m_LastAcceptedDir.path() : dir,
options
)
);
if( !path.isNull() )
I18nMainWindow::m_LastAcceptedDir.setPath( path );
return path;
}
/*****************************************************************************/
inline
QString
I18nMainWindow
::GetOpenFileName( QWidget* p,
const QString& caption,
const QString& dir,
const QString& filter,
QString* selectedFilter,
QFileDialog::Options options )
{
QString filename(
QFileDialog::getOpenFileName(
p,
caption,
dir.isEmpty() ? I18nMainWindow::m_LastAcceptedDir.path() : dir,
filter,
selectedFilter,
options
)
);
if( !filename.isNull() )
I18nMainWindow::m_LastAcceptedDir.setPath( QFileInfo( filename ).path() );
return filename;
}
/*****************************************************************************/
inline
QStringList
I18nMainWindow
::GetOpenFileNames( QWidget* p,
const QString& caption,
const QString& dir,
const QString& filter,
QString* selectedFilter,
QFileDialog::Options options )
{
QStringList filenames(
QFileDialog::getOpenFileNames(
p,
caption,
dir.isEmpty() ? I18nMainWindow::m_LastAcceptedDir.path() : dir,
filter,
selectedFilter,
options
)
);
if( !filenames.isEmpty() )
I18nMainWindow::m_LastAcceptedDir.setPath(
QFileInfo( filenames.back() ).path()
);
return filenames;
}
/*****************************************************************************/
inline
QString
I18nMainWindow
::GetSaveFileName( QWidget* p,
const QString& caption,
const QString& dir,
const QString& filter,
QString* selectedFilter,
QFileDialog::Options options )
{
QString filename(
QFileDialog::getSaveFileName(
p,
caption,
dir.isEmpty() ? I18nMainWindow::m_LastAcceptedDir.path() : dir,
filter,
selectedFilter,
options
)
);
if( !filename.isNull() )
I18nMainWindow::m_LastAcceptedDir.setPath( QFileInfo( filename ).path() );
return filename;
}
} // end namespace 'mvd'
#endif // I18nMainWindow_h
......@@ -65,13 +65,11 @@ namespace
/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION */
/*****************************************************************************/
QDir
I18nMainWindow::m_LastAcceptedDir( QDir::home().path() );
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*****************************************************************************/
I18nMainWindow
::I18nMainWindow( QWidget* p, Qt::WindowFlags flags ) :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment