[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/khtml/html
From: George Staikos <staikos () kde ! org>
Date: 2004-10-29 22:51:27
Message-ID: 20041029225127.9967F16CDC () office ! kde ! org
[Download RAW message or body]
CVS commit by staikos:
- strip whitespace from filenames from the requester (not sure if this was done
somewhere else already, but better to be safe I guess)
- warn the user when he types in a filename that is not found and allow him to
abort and try again (major annoyance for me)
M +21 -4 html_formimpl.cpp 1.397
--- kdelibs/khtml/html/html_formimpl.cpp #1.396:1.397
@@ -247,5 +247,5 @@ QByteArray HTMLFormElementImpl::formData
m_encCharset[i] = m_encCharset[i].latin1() == ' ' ? QChar('-') : \
m_encCharset[i].lower();
- QStringList fileUploads;
+ QStringList fileUploads, fileNotUploads;
for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); \
it.current(); ++it) { @@ -294,5 +294,5 @@ QByteArray HTMLFormElementImpl::formData
{
KURL path;
- QString val = \
static_cast<HTMLInputElementImpl*>(current)->value().string(); + \
QString val = static_cast<HTMLInputElementImpl*>(current)->value().string().stripWhiteSpace();
if (!val.isEmpty() &&
QDir::isRelativePath(val) &&
@@ -304,5 +304,5 @@ QByteArray HTMLFormElementImpl::formData
hstr += fixUpfromUnicode(codec, "; filename=\"" + \
path.fileName() + "\"");
- if(path.isValid()) {
+ if (path.isValid()) {
fileUploads << path.prettyURL(0, \
KURL::StripFileProtocol);
const KMimeType::Ptr ptr = KMimeType::findByURL(path);
@@ -311,4 +311,6 @@ QByteArray HTMLFormElementImpl::formData
hstr += ptr->name().ascii();
}
+ } else if (!val.isEmpty()) {
+ fileNotUploads << path.prettyURL(0, \
KURL::StripFileProtocol); }
}
@@ -338,4 +340,19 @@ QByteArray HTMLFormElementImpl::formData
}
+ if (fileNotUploads.count()) {
+ const int result = KMessageBox::warningContinueCancelList( 0,
+ i18n("The following \
files will not be uploaded" + \
" because they could not be found.\n" + \
"Do you want to continue?"), + \
fileNotUploads, + \
i18n("Submit Confirmation"),KGuiItem(i18n("&Submit Anyway"))); +
+
+ if (result == KMessageBox::Cancel) {
+ ok = false;
+ return QByteArray();
+ }
+ }
+
if (fileUploads.count()) {
const int result = KMessageBox::warningContinueCancelList( 0,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic