Qt4: textedit improvements

This patch sets the default document type in the "File save" dialog to
HTML and makes both the "File open" and "File save" dialogs enter the "/"
directory by default.

Fixes #274.
This commit is contained in:
Christian Prochaska 2012-07-10 14:47:59 +02:00 committed by Norman Feske
parent 5c731c97cd
commit 763f628831

View File

@ -11,6 +11,33 @@ diff --git a/demos/textedit/main.cpp b/demos/textedit/main.cpp
mw.show();
return a.exec();
}
diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp
--- a/demos/textedit/textedit.cpp
+++ b/demos/textedit/textedit.cpp
@@ -463,7 +463,7 @@
void TextEdit::fileOpen()
{
QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
- QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
+ QString("/"), tr("HTML-Files (*.htm *.html);;All Files (*)"));
if (!fn.isEmpty())
load(fn);
}
@@ -483,11 +483,11 @@
bool TextEdit::fileSaveAs()
{
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
- QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"));
+ QString("/"), tr("HTML-Files (*.htm *.html);;All Files (*)"));
if (fn.isEmpty())
return false;
- if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
- fn += ".odt"; // default
+ if (! (fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
+ fn += ".html"; // default
setCurrentFileName(fn);
return fileSave();
}
diff --git a/demos/textedit/textedit.pro b/demos/textedit/textedit.pro
--- a/demos/textedit/textedit.pro
+++ b/demos/textedit/textedit.pro