┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/revisioncontrolplugin.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-08-01 18:33:12 +0000
committerPeter Penz <[email protected]>2009-08-01 18:33:12 +0000
commit22718cef13818ab97d745530bb2b4a6826053520 (patch)
treed9c805dda89b904c57d5b144f2e875a60d9d5b2a /src/revisioncontrolplugin.cpp
parent0706af30c0e08c105e86d49f310f9f0e0f13c3e6 (diff)
Use QTemporaryFile instead of QFile. This assures an automatic deleting of the file and works reliable on multiuser system. Thanks to André Wöbbeking for the hint!
svn path=/trunk/KDE/kdebase/apps/; revision=1005674
Diffstat (limited to 'src/revisioncontrolplugin.cpp')
-rw-r--r--src/revisioncontrolplugin.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/revisioncontrolplugin.cpp b/src/revisioncontrolplugin.cpp
index 77a7b1290..683398879 100644
--- a/src/revisioncontrolplugin.cpp
+++ b/src/revisioncontrolplugin.cpp
@@ -40,7 +40,6 @@ RevisionControlPlugin::~RevisionControlPlugin()
#include <kshell.h>
#include <kvbox.h>
#include <QDir>
-#include <QFile>
#include <QLabel>
#include <QProcess>
#include <QString>
@@ -60,7 +59,8 @@ SubversionPlugin::SubversionPlugin() :
m_errorMsg(),
m_operationCompletedMsg(),
m_contextDir(),
- m_contextItems()
+ m_contextItems(),
+ m_tempFile()
{
m_updateAction = new KAction(this);
m_updateAction->setIcon(KIcon("view-refresh"));
@@ -273,19 +273,21 @@ void SubversionPlugin::commitFiles()
dialog.restoreDialogSize(dialogConfig);
if (dialog.exec() == QDialog::Accepted) {
- // write the commit description into a temporary file, so
- // that it can be read by the command "svn commit -F"
- QFile file(QDir::tempPath() + "/svn_commit_descr.txt");
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ // Write the commit description into a temporary file, so
+ // that it can be read by the command "svn commit -F". The temporary
+ // file must stay alive until slotOperationCompleted() is invoked and will
+ // be destroyed when the revision plugin is destructed.
+ if (!m_tempFile.open()) {
emit errorMessage(i18nc("@info:status", "Commit of SVN changes failed."));
return;
}
- QTextStream out(&file);
+ QTextStream out(&m_tempFile);
+ const QString fileName = m_tempFile.fileName();
out << editor->toPlainText();
- file.close();
+ m_tempFile.close();
- execSvnCommand("commit -F " + KShell::quoteArg(file.fileName()),
+ execSvnCommand("commit -F " + KShell::quoteArg(fileName),
i18nc("@info:status", "Committing SVN changes..."),
i18nc("@info:status", "Commit of SVN changes failed."),
i18nc("@info:status", "Committed SVN changes."));