[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Mon Dec 19 17:57:22 CET 2005
SVN commit 489747 by staikos:
- don't block the interpreter by prompting during a save
- note a place where KIO support is missing
M +2 -6 extensions/js/bind_document.cpp
M +8 -3 kstdoc.cpp
M +1 -1 kstdoc.h
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_document.cpp #489746:489747
@@ -242,10 +242,8 @@
exec->setException(eobj);
return KJS::Boolean(false);
}
- // Warning: this can still block. FIXME. KstDoc::saveDocument needs a
- // non-blocking flag
app->slotUpdateStatusMsg(i18n("Saving file..."));
- bool rc = app->document()->saveDocument(args[0].toString(exec).qstring());
+ bool rc = app->document()->saveDocument(args[0].toString(exec).qstring(), false, false);
app->slotUpdateStatusMsg(i18n("Ready"));
return KJS::Boolean(rc);
}
@@ -254,10 +252,8 @@
return KJS::Boolean(false);
}
- // Warning: this can still block. FIXME. KstDoc::saveDocument needs a
- // non-blocking flag
app->slotUpdateStatusMsg(i18n("Saving file..."));
- bool rc = app->document()->saveDocument(app->document()->absFilePath());
+ bool rc = app->document()->saveDocument(app->document()->absFilePath(), false, false);
app->slotUpdateStatusMsg(i18n("Ready"));
return KJS::Boolean(rc);
}
--- trunk/extragear/graphics/kst/kst/kstdoc.cpp #489746:489747
@@ -685,11 +685,12 @@
ts << "</kstdoc>" << endl;
}
-bool KstDoc::saveDocument(const QString &filename, bool saveAbsoluteVectorPositions) {
+
+bool KstDoc::saveDocument(const QString& filename, bool saveAbsoluteVectorPositions, bool prompt) {
backupFile(filename);
QFile f(filename);
- if (f.exists() && filename != absFilePath()) {
+ if (prompt && f.exists() && filename != absFilePath()) {
if (KMessageBox::warningYesNo(KstApp::inst(), i18n("%1: A file of this name already exists.").arg(filename),
i18n("Warning"),i18n("&Overwrite"),
i18n("&Cancel")) == KMessageBox::No) {
@@ -698,10 +699,13 @@
}
if (!f.open(IO_WriteOnly|IO_Truncate)) {
- KMessageBox::sorry(KstApp::inst(), i18n("%1: Could not open file for saving. The plot description has not been saved. Try a different filename or directory.").arg(filename));
+ if (prompt) {
+ KMessageBox::sorry(KstApp::inst(), i18n("%1: Could not open file for saving. The plot description has not been saved. Try a different filename or directory.").arg(filename));
+ }
return false;
}
+ // FIXME: KIO enable
QTextStream ts(&f);
ts.setEncoding(QTextStream::UnicodeUTF8);
@@ -760,6 +764,7 @@
emit updateDialogs();
}
+
void KstDoc::samplesUp() {
bool changed = false;
KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
--- trunk/extragear/graphics/kst/kst/kstdoc.h #489746:489747
@@ -52,7 +52,7 @@
/** saves the document to a QTextStream */
void saveDocument(QTextStream& ts, bool saveAbsoluteVectorPositions = false);
/** saves the document under filename */
- bool saveDocument(const QString& filename, bool saveAbsoluteVectorPositions = false);
+ bool saveDocument(const QString& filename, bool saveAbsoluteVectorPositions = false, bool prompt = true);
/** returns the pathname of the current document file*/
const QString& absFilePath() const;
/** returns the title of the document */
More information about the Kst
mailing list