Modifications sur les choix des dossiers cibles par defaut lors des operations d'ouverture et d'enregistrement de fichiers.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@722 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2009-07-13 00:59:46 +00:00
parent 21ac12f5da
commit 0adac494c8
5 changed files with 20 additions and 4 deletions

View File

@@ -191,7 +191,7 @@ QWidget *ExportDialog::leftPart() {
QHBoxLayout *hboxLayout = new QHBoxLayout(); QHBoxLayout *hboxLayout = new QHBoxLayout();
QLabel *dirpath_label = new QLabel(tr("Dossier cible :"), this); QLabel *dirpath_label = new QLabel(tr("Dossier cible :"), this);
dirpath = new QLineEdit(this); dirpath = new QLineEdit(this);
dirpath -> setText(QDir::toNativeSeparators(QDir::homePath())); dirpath -> setText(QDir::toNativeSeparators(project_ -> currentDir()));
QCompleter *completer = new QCompleter(this); QCompleter *completer = new QCompleter(this);
completer -> setModel(new QDirModel(completer)); completer -> setModel(new QDirModel(completer));
dirpath -> setCompleter(completer); dirpath -> setCompleter(completer);
@@ -358,7 +358,7 @@ void ExportDialog::slot_chooseADirectory() {
QString user_dir = QFileDialog::getExistingDirectory( QString user_dir = QFileDialog::getExistingDirectory(
this, this,
tr("Exporter dans le dossier", "dialog title"), tr("Exporter dans le dossier", "dialog title"),
QDir::homePath() dirpath -> text()
); );
if (!user_dir.isEmpty()) { if (!user_dir.isEmpty()) {
dirpath -> setText(user_dir); dirpath -> setText(user_dir);

View File

@@ -650,7 +650,7 @@ bool ProjectView::saveAs() {
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this, this,
tr("Enregistrer sous", "dialog title"), tr("Enregistrer sous", "dialog title"),
(project_ -> filePath().isEmpty() ? QDir::homePath() : QDir(project_ -> filePath())).absolutePath(), project_ -> currentDir(),
tr("Sch\351ma QElectroTech (*.qet)", "filetypes allowed when saving a diagram file") tr("Sch\351ma QElectroTech (*.qet)", "filetypes allowed when saving a diagram file")
); );

View File

@@ -34,7 +34,7 @@
*/ */
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
open_dialog_dir(QDir::homePath()), open_dialog_dir(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)),
can_update_actions(true) can_update_actions(true)
{ {
// mise en place de l'interface MDI au centre de l'application // mise en place de l'interface MDI au centre de l'application

View File

@@ -169,6 +169,21 @@ void QETProject::setFilePath(const QString &filepath) {
emit(projectInformationsChanged(this)); emit(projectInformationsChanged(this));
} }
/**
@return le dossier contenant le fichier projet si celui-ci a ete
enregistre ; dans le cas contraire, cette methode retourne l'emplacement
du bureau de l'utilisateur.
*/
QString QETProject::currentDir() const {
QString current_directory;
if (file_path_.isEmpty()) {
current_directory = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
} else {
current_directory = QFileInfo(file_path_).absoluteDir().absolutePath();
}
return(current_directory);
}
/** /**
@return une chaine de caractere du type "Projet titre du projet". @return une chaine de caractere du type "Projet titre du projet".

View File

@@ -73,6 +73,7 @@ class QETProject : public QObject {
ElementsCollection *embeddedCollection() const; ElementsCollection *embeddedCollection() const;
QString filePath(); QString filePath();
void setFilePath(const QString &); void setFilePath(const QString &);
QString currentDir() const;
QString pathNameTitle() const; QString pathNameTitle() const;
QString title() const; QString title() const;
void setTitle(const QString &); void setTitle(const QString &);