[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise4/kdepim/kleopatra/utils
From: Marc Mutz <mutz () kde ! org>
Date: 2010-10-26 16:07:01
Message-ID: 20101026160701.E0AEAAC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1190011 by mutz:
Input: allow to call errorString() more than once
M +13 -2 input.cpp
--- branches/kdepim/enterprise4/kdepim/kleopatra/utils/input.cpp #1190010:1190011
@@ -39,6 +39,7 @@
#include "kdpipeiodevice.h"
#include "log.h"
#include "kleo_assert.h"
+#include "cached.h"
#include <kleo/exception.h>
@@ -80,6 +81,13 @@
void setDefaultLabel( const QString & l ) { m_defaultLabel = l; }
/* reimp */ void setLabel( const QString & l ) { m_customLabel = l; }
/* reimp */ QString errorString() const {
+ if ( m_errorString.dirty() )
+ m_errorString = doErrorString();
+ return m_errorString;
+ }
+
+ private:
+ virtual QString doErrorString() const {
if ( const shared_ptr<QIODevice> io = ioDevice() )
return io->errorString();
else
@@ -89,6 +97,7 @@
private:
QString m_customLabel;
QString m_defaultLabel;
+ mutable cached<QString> m_errorString;
};
@@ -113,9 +122,11 @@
/* reimp */ unsigned int classification() const { return 0U; } // plain text
/* reimp */ unsigned long long size() const { return 0; }
/* reimp */ QString label() const;
- /* reimp */ QString errorString() const;
private:
+ /* reimp */ QString doErrorString() const;
+
+ private:
const QString m_command;
const QStringList m_arguments;
const shared_ptr<Process> m_proc;
@@ -300,7 +311,7 @@
return i18nc( "e.g. \"Output of tar xf - file\"", "Output of %1", cmdline );
}
-QString ProcessStdOutInput::errorString() const {
+QString ProcessStdOutInput::doErrorString() const {
kleo_assert( m_proc );
if ( m_proc->exitStatus() == QProcess::NormalExit && m_proc->exitCode() == 0 )
return QString();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic